• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2021-2023 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 *     http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16/// <reference path="../../../component/common.d.ts" />
17
18import { TouchObject, KeyEvent, MouseEvent } from 'SpecialEvent';
19
20/**
21 * Defines the console info.
22 *
23 * @syscap SystemCapability.ArkUI.ArkUI.Full
24 * @since 7
25 */
26/**
27 * Defines the console info.
28 *
29 * @syscap SystemCapability.ArkUI.ArkUI.Full
30 * @since 9
31 * @form
32 */
33/**
34 * Defines the console info.
35 *
36 * @syscap SystemCapability.ArkUI.ArkUI.Full
37 * @crossplatform
38 * @since 10
39 * @form
40 */
41/**
42 * Defines the console info.
43 *
44 * @syscap SystemCapability.ArkUI.ArkUI.Full
45 * @crossplatform
46 * @atomicservice
47 * @since 11
48 * @form
49 */
50export declare class console {
51  /**
52   * Prints "debug" logs.
53   *
54   * @param { string } message - Text to print.
55   * @param { any[] } arguments
56   * @syscap SystemCapability.ArkUI.ArkUI.Full
57   * @since 7
58   */
59  /**
60   * Prints "debug" logs.
61   *
62   * @param { string } message - Text to print.
63   * @param { any[] } arguments
64   * @syscap SystemCapability.ArkUI.ArkUI.Full
65   * @since 9
66   * @form
67   */
68  /**
69   * Prints "debug" logs.
70   *
71   * @param { string } message - Text to print.
72   * @param { any[] } arguments
73   * @syscap SystemCapability.ArkUI.ArkUI.Full
74   * @crossplatform
75   * @since 10
76   * @form
77   */
78  /**
79   * Prints "debug" logs.
80   *
81   * @param { string } message - Text to print.
82   * @param { any[] } arguments
83   * @syscap SystemCapability.ArkUI.ArkUI.Full
84   * @crossplatform
85   * @atomicservice
86   * @since 11
87   * @form
88   */
89  static debug(message: string, ...arguments: any[]): void;
90
91  /**
92   * Prints "log" logs.
93   *
94   * @param { string } message - Text to print.
95   * @param { any[] } arguments
96   * @syscap SystemCapability.ArkUI.ArkUI.Full
97   * @since 7
98   */
99  /**
100   * Prints "log" logs.
101   *
102   * @param { string } message - Text to print.
103   * @param { any[] } arguments
104   * @syscap SystemCapability.ArkUI.ArkUI.Full
105   * @since 9
106   * @form
107   */
108  /**
109   * Prints "log" logs.
110   *
111   * @param { string } message - Text to print.
112   * @param { any[] } arguments
113   * @syscap SystemCapability.ArkUI.ArkUI.Full
114   * @crossplatform
115   * @since 10
116   * @form
117   */
118  /**
119   * Prints "log" logs.
120   *
121   * @param { string } message - Text to print.
122   * @param { any[] } arguments
123   * @syscap SystemCapability.ArkUI.ArkUI.Full
124   * @crossplatform
125   * @atomicservice
126   * @since 11
127   * @form
128   */
129  static log(message: string, ...arguments: any[]): void;
130
131  /**
132   * Prints "info" logs.
133   *
134   * @param { string } message - Text to print.
135   * @param { any[] } arguments
136   * @syscap SystemCapability.ArkUI.ArkUI.Full
137   * @since 7
138   */
139  /**
140   * Prints "info" logs.
141   *
142   * @param { string } message - Text to print.
143   * @param { any[] } arguments
144   * @syscap SystemCapability.ArkUI.ArkUI.Full
145   * @since 9
146   * @form
147   */
148  /**
149   * Prints "info" logs.
150   *
151   * @param { string } message - Text to print.
152   * @param { any[] } arguments
153   * @syscap SystemCapability.ArkUI.ArkUI.Full
154   * @crossplatform
155   * @since 10
156   * @form
157   */
158  /**
159   * Prints "info" logs.
160   *
161   * @param { string } message - Text to print.
162   * @param { any[] } arguments
163   * @syscap SystemCapability.ArkUI.ArkUI.Full
164   * @crossplatform
165   * @atomicservice
166   * @since 11
167   * @form
168   */
169  static info(message: string, ...arguments: any[]): void;
170
171  /**
172   * Prints "warn" logs.
173   *
174   * @param { string } message - Text to print.
175   * @param { any[] } arguments
176   * @syscap SystemCapability.ArkUI.ArkUI.Full
177   * @since 7
178   */
179  /**
180   * Prints "warn" logs.
181   *
182   * @param { string } message - Text to print.
183   * @param { any[] } arguments
184   * @syscap SystemCapability.ArkUI.ArkUI.Full
185   * @since 9
186   * @form
187   */
188  /**
189   * Prints "warn" logs.
190   *
191   * @param { string } message - Text to print.
192   * @param { any[] } arguments
193   * @syscap SystemCapability.ArkUI.ArkUI.Full
194   * @crossplatform
195   * @since 10
196   * @form
197   */
198  /**
199   * Prints "warn" logs.
200   *
201   * @param { string } message - Text to print.
202   * @param { any[] } arguments
203   * @syscap SystemCapability.ArkUI.ArkUI.Full
204   * @crossplatform
205   * @atomicservice
206   * @since 11
207   * @form
208   */
209  static warn(message: string, ...arguments: any[]): void;
210
211  /**
212   * Prints "error" logs.
213   *
214   * @param { string } message - Text to print.
215   * @param { any[] } arguments
216   * @syscap SystemCapability.ArkUI.ArkUI.Full
217   * @since 7
218   */
219  /**
220   * Prints "error" logs.
221   *
222   * @param { string } message - Text to print.
223   * @param { any[] } arguments
224   * @syscap SystemCapability.ArkUI.ArkUI.Full
225   * @since 9
226   * @form
227   */
228  /**
229   * Prints "error" logs.
230   *
231   * @param { string } message - Text to print.
232   * @param { any[] } arguments
233   * @syscap SystemCapability.ArkUI.ArkUI.Full
234   * @crossplatform
235   * @since 10
236   * @form
237   */
238  /**
239   * Prints "error" logs.
240   *
241   * @param { string } message - Text to print.
242   * @param { any[] } arguments
243   * @syscap SystemCapability.ArkUI.ArkUI.Full
244   * @crossplatform
245   * @atomicservice
246   * @since 11
247   * @form
248   */
249  static error(message: string, ...arguments: any[]): void;
250
251  /**
252   * Prints a message if value is false or omitted.
253   *
254   * @param { Object } [value] - The value tested for being truthy.
255   * @param { Object[] } arguments - Used as error message to print.
256   * @throws { BusinessError } 401 - The parameter check failed.
257   * @static
258   * @syscap SystemCapability.Utils.Lang
259   * @crossplatform
260   * @since 10
261   */
262  static assert(value?: Object, ...arguments: Object[]): void;
263
264  /**
265   * Maintains an internal counter specific to label and print the number of times
266   * console.count() has been called with the given label.
267   *
268   * @param { string } [label] - Counter name. Default: "default".
269   * @throws { BusinessError } 401 - The parameter check failed.
270   * @static
271   * @syscap SystemCapability.Utils.Lang
272   * @crossplatform
273   * @since 10
274   */
275  static count(label?: string): void;
276
277  /**
278   * Reset the internal counter specific to label.
279   *
280   * @param { string } [label] - Counter name. Default: "default".
281   * @throws { BusinessError } 401 - The parameter check failed.
282   * @static
283   * @syscap SystemCapability.Utils.Lang
284   * @crossplatform
285   * @since 10
286   */
287  static countReset(label?: string): void;
288
289  /**
290   * Prints properties of the specified JavaScript object.
291   *
292   * @param { Object } [dir] - A JavaScript object whose properties should be output.
293   * @static
294   * @syscap SystemCapability.Utils.Lang
295   * @crossplatform
296   * @since 10
297   */
298  static dir(dir?: Object): void;
299
300  /**
301   * This method calls console.log() passing it the arguments received.
302   * This method does not produce any XML formatting.
303   *
304   * @param { Object[] } arguments - Text to print.
305   * @static
306   * @syscap SystemCapability.Utils.Lang
307   * @crossplatform
308   * @since 10
309   */
310  static dirxml(...arguments: Object[]): void;
311
312  /**
313   * Creates a new inline group, causing any subsequent console messages to be indented by an additional level.
314   *
315   * @param { Object[] } arguments - messages to print first.
316   * @static
317   * @syscap SystemCapability.Utils.Lang
318   * @crossplatform
319   * @since 10
320   */
321  static group(...arguments: Object[]): void;
322
323  /**
324   * Same as console.group()
325   *
326   * @param { Object[] } arguments - messages to print first.
327   * @static
328   * @syscap SystemCapability.Utils.Lang
329   * @crossplatform
330   * @since 10
331   */
332  static groupCollapsed(...arguments: Object[]): void;
333
334  /**
335   * Exit current inline group.
336   *
337   * @static
338   * @syscap SystemCapability.Utils.Lang
339   * @crossplatform
340   * @since 10
341   */
342  static groupEnd(): void;
343
344  /**
345   * Prints tabular data as a table.
346   *
347   * @param { Object } [tableData] - tabular data.
348   * @static
349   * @syscap SystemCapability.Utils.Lang
350   * @crossplatform
351   * @since 10
352   */
353  static table(tableData?: Object): void;
354
355  /**
356   * Start a timer.
357   *
358   * @param { string } [label] - Timer name. Default: "default".
359   * @throws { BusinessError } 401 - The parameter check failed.
360   * @static
361   * @syscap SystemCapability.Utils.Lang
362   * @crossplatform
363   * @since 10
364   */
365  static time(label?: string): void;
366
367  /**
368   * End a timer and print time duration.
369   *
370   * @param { string } [label] - Timer name. Default: "default".
371   * @throws { BusinessError } 401 - The parameter check failed.
372   * @static
373   * @syscap SystemCapability.Utils.Lang
374   * @crossplatform
375   * @since 10
376   */
377  static timeEnd(label?: string): void;
378
379  /**
380   * Print the elapsed time and other data arguments.
381   *
382   * @param { string } [label] - Timer name. Default: "default".
383   * @param { Object[] } arguments - Text to print.
384   * @throws { BusinessError } 401 - The parameter check failed.
385   * @static
386   * @syscap SystemCapability.Utils.Lang
387   * @crossplatform
388   * @since 10
389   */
390  static timeLog(label?: string, ...arguments: Object[]): void;
391
392  /**
393   * Prints stack information for the current code location.
394   *
395   * @param { Object[] } arguments - message to print.
396   * @static
397   * @syscap SystemCapability.Utils.Lang
398   * @crossplatform
399   * @since 10
400   */
401  static trace(...arguments: Object[]): void;
402}
403
404/**
405 * Sets the interval for repeatedly calling a function.
406 *
407 * @param { Function | string } handler - Indicates the function to be called after the timer goes off.
408 * For devices of "tv", "phone, tablet", and "wearable" types, this parameter can be a function or string.
409 * For devices of "lite wearable" and "smartVision" types, this parameter must be a function.
410 * @param { number } delay - Indicates the interval between each two calls, in milliseconds. The function will be called after this delay.
411 * @param { any[] } arguments - Indicates additional arguments to pass to "handler" when the timer goes off.
412 * @returns { number } Returns the timer ID.
413 * @syscap SystemCapability.ArkUI.ArkUI.Full
414 * @since 7
415 */
416/**
417 * Sets the interval for repeatedly calling a function.
418 *
419 * @param { Function | string } handler - Indicates the function to be called after the timer goes off.
420 * For devices of "tv", "phone, tablet", and "wearable" types, this parameter can be a function or string.
421 * For devices of "lite wearable" and "smartVision" types, this parameter must be a function.
422 * @param { number } delay - Indicates the interval between each two calls, in milliseconds. The function will be called after this delay.
423 * @param { any[] } arguments - Indicates additional arguments to pass to "handler" when the timer goes off.
424 * @returns { number } Returns the timer ID.
425 * @syscap SystemCapability.ArkUI.ArkUI.Full
426 * @crossplatform
427 * @since 10
428 */
429/**
430 * Sets the interval for repeatedly calling a function.
431 *
432 * @param { Function | string } handler - Indicates the function to be called after the timer goes off.
433 * For devices of "tv", "phone, tablet", and "wearable" types, this parameter can be a function or string.
434 * For devices of "lite wearable" and "smartVision" types, this parameter must be a function.
435 * @param { number } delay - Indicates the interval between each two calls, in milliseconds. The function will be called after this delay.
436 * @param { any[] } arguments - Indicates additional arguments to pass to "handler" when the timer goes off.
437 * @returns { number } Returns the timer ID.
438 * @syscap SystemCapability.ArkUI.ArkUI.Full
439 * @crossplatform
440 * @atomicservice
441 * @since 11
442 */
443export declare function setInterval(handler: Function | string, delay: number, ...arguments: any[]): number;
444
445/**
446 * Sets a timer after which a function will be executed.
447 *
448 * @param { Function | string } handler - Indicates the function to be called after the timer goes off.
449 * For devices of "tv", "phone, tablet", and "wearable" types, this parameter can be a function or string.
450 * For devices of "lite wearable" and "smartVision" types, this parameter must be a function.
451 * @param { number } [delay] - Indicates the delay (in milliseconds) after which the function will be called.
452 * If this parameter is left empty, default value "0" will be used, which means that the function will be called immediately or as soon as possible.
453 * @param { any[] } arguments - Indicates additional arguments to pass to "handler" when the timer goes off.
454 * @returns { number } Returns the timer ID.
455 * @syscap SystemCapability.ArkUI.ArkUI.Full
456 * @since 7
457 */
458/**
459 * Sets a timer after which a function will be executed.
460 *
461 * @param { Function | string } handler - Indicates the function to be called after the timer goes off.
462 * For devices of "tv", "phone, tablet", and "wearable" types, this parameter can be a function or string.
463 * For devices of "lite wearable" and "smartVision" types, this parameter must be a function.
464 * @param { number } [delay] - Indicates the delay (in milliseconds) after which the function will be called.
465 * If this parameter is left empty, default value "0" will be used, which means that the function will be called immediately or as soon as possible.
466 * @param { any[] } [arguments] - Indicates additional arguments to pass to "handler" when the timer goes off.
467 * @returns { number } Returns the timer ID.
468 * @syscap SystemCapability.ArkUI.ArkUI.Full
469 * @crossplatform
470 * @since 10
471 */
472/**
473 * Sets a timer after which a function will be executed.
474 *
475 * @param { Function | string } handler - Indicates the function to be called after the timer goes off.
476 * For devices of "tv", "phone, tablet", and "wearable" types, this parameter can be a function or string.
477 * For devices of "lite wearable" and "smartVision" types, this parameter must be a function.
478 * @param { number } [delay] - Indicates the delay (in milliseconds) after which the function will be called.
479 * If this parameter is left empty, default value "0" will be used, which means that the function will be called immediately or as soon as possible.
480 * @param { any[] } [arguments] - Indicates additional arguments to pass to "handler" when the timer goes off.
481 * @returns { number } Returns the timer ID.
482 * @syscap SystemCapability.ArkUI.ArkUI.Full
483 * @crossplatform
484 * @atomicservice
485 * @since 11
486 */
487export declare function setTimeout(handler: Function | string, delay?: number, ...arguments: any[]): number;
488
489/**
490 * Cancel the interval set by " setInterval()".
491 *
492 * @param { number } [intervalID] - Indicates the timer ID returned by "setInterval()".
493 * @syscap SystemCapability.ArkUI.ArkUI.Full
494 * @since 7
495 */
496/**
497 * Cancel the interval set by " setInterval()".
498 *
499 * @param { number } [intervalID] - Indicates the timer ID returned by "setInterval()".
500 * @syscap SystemCapability.ArkUI.ArkUI.Full
501 * @crossplatform
502 * @since 10
503 */
504/**
505 * Cancel the interval set by " setInterval()".
506 *
507 * @param { number } [intervalID] - Indicates the timer ID returned by "setInterval()".
508 * @syscap SystemCapability.ArkUI.ArkUI.Full
509 * @crossplatform
510 * @atomicservice
511 * @since 11
512 */
513export declare function clearInterval(intervalID?: number): void;
514
515/**
516 * Cancel the timer set by "setTimeout()".
517 *
518 * @param { number } [timeoutID] - Indicates the timer ID returned by "setTimeout()".
519 * @syscap SystemCapability.ArkUI.ArkUI.Full
520 * @since 7
521 */
522/**
523 * Cancel the timer set by "setTimeout()".
524 *
525 * @param { number } [timeoutID] - Indicates the timer ID returned by "setTimeout()".
526 * @syscap SystemCapability.ArkUI.ArkUI.Full
527 * @crossplatform
528 * @since 10
529 */
530/**
531 * Cancel the timer set by "setTimeout()".
532 *
533 * @param { number } [timeoutID] - Indicates the timer ID returned by "setTimeout()".
534 * @syscap SystemCapability.ArkUI.ArkUI.Full
535 * @crossplatform
536 * @atomicservice
537 * @since 11
538 */
539export declare function clearTimeout(timeoutID?: number): void;
540
541/**
542 * Defining syscap function.
543 *
544 * @param { string } syscap
545 * @returns { boolean }
546 * @syscap SystemCapability.ArkUI.ArkUI.Full
547 * @since 8
548 */
549/**
550 * Defining syscap function.
551 *
552 * @param { string } syscap
553 * @returns { boolean }
554 * @syscap SystemCapability.ArkUI.ArkUI.Full
555 * @crossplatform
556 * @since 10
557 */
558/**
559 * Defining syscap function.
560 *
561 * @param { string } syscap
562 * @returns { boolean }
563 * @syscap SystemCapability.ArkUI.ArkUI.Full
564 * @crossplatform
565 * @atomicservice
566 * @since 11
567 */
568export declare function canIUse(syscap: string): boolean;
569
570/**
571 * Obtains all attributes of the component with the specified ID.
572 *
573 * @param { string } id - ID of the component whose attributes are to be obtained.
574 * @returns { string }
575 * @syscap SystemCapability.ArkUI.ArkUI.Full
576 * @since 9
577 * @test
578 */
579/**
580 * Obtains all attributes of the component with the specified ID.
581 *
582 * @param { string } id - ID of the component whose attributes are to be obtained.
583 * @returns { string }
584 * @syscap SystemCapability.ArkUI.ArkUI.Full
585 * @crossplatform
586 * @since 10
587 * @test
588 */
589/**
590 * Obtains all attributes of the component with the specified ID.
591 *
592 * @param { string } id - ID of the component whose attributes are to be obtained.
593 * @returns { string }
594 * @syscap SystemCapability.ArkUI.ArkUI.Full
595 * @crossplatform
596 * @atomicservice
597 * @since 11
598 * @test
599 */
600export declare function getInspectorByKey(id: string): string;
601
602/**
603 * Get components tree.
604 *
605 * @returns { Object }
606 * @syscap SystemCapability.ArkUI.ArkUI.Full
607 * @since 9
608 * @test
609 */
610/**
611 * Get components tree.
612 *
613 * @returns { Object }
614 * @syscap SystemCapability.ArkUI.ArkUI.Full
615 * @crossplatform
616 * @since 10
617 * @test
618 */
619/**
620 * Get components tree.
621 *
622 * @returns { Object }
623 * @syscap SystemCapability.ArkUI.ArkUI.Full
624 * @crossplatform
625 * @atomicservice
626 * @since 11
627 * @test
628 */
629export declare function getInspectorTree(): Object;
630
631/**
632 * Sends an event to the component with the specified ID.
633 *
634 * @param { string } id - ID of the component for which the event is to be sent.
635 * @param { number } action - Type of the event to be sent. The options are as follows: Click event: 10 LongClick: 11.
636 * @param { string } params - Event parameters. If there is no parameter, pass an empty string "".
637 * @returns { boolean }
638 * @syscap SystemCapability.ArkUI.ArkUI.Full
639 * @since 9
640 * @test
641 */
642/**
643 * Sends an event to the component with the specified ID.
644 *
645 * @param { string } id - ID of the component for which the event is to be sent.
646 * @param { number } action - Type of the event to be sent. The options are as follows: Click event: 10 LongClick: 11.
647 * @param { string } params - Event parameters. If there is no parameter, pass an empty string "".
648 * @returns { boolean }
649 * @syscap SystemCapability.ArkUI.ArkUI.Full
650 * @crossplatform
651 * @since 10
652 * @test
653 */
654/**
655 * Sends an event to the component with the specified ID.
656 *
657 * @param { string } id - ID of the component for which the event is to be sent.
658 * @param { number } action - Type of the event to be sent. The options are as follows: Click event: 10 LongClick: 11.
659 * @param { string } params - Event parameters. If there is no parameter, pass an empty string "".
660 * @returns { boolean }
661 * @syscap SystemCapability.ArkUI.ArkUI.Full
662 * @crossplatform
663 * @atomicservice
664 * @since 11
665 * @test
666 */
667export declare function sendEventByKey(id: string, action: number, params: string): boolean;
668
669/**
670 * Send touch event.
671 *
672 * @param { TouchObject } event - TouchObject to be sent.
673 * @returns { boolean }
674 * @syscap SystemCapability.ArkUI.ArkUI.Full
675 * @since 9
676 * @test
677 */
678/**
679 * Send touch event.
680 *
681 * @param { TouchObject } event - TouchObject to be sent.
682 * @returns { boolean }
683 * @syscap SystemCapability.ArkUI.ArkUI.Full
684 * @crossplatform
685 * @since 10
686 * @test
687 */
688/**
689 * Send touch event.
690 *
691 * @param { TouchObject } event - TouchObject to be sent.
692 * @returns { boolean }
693 * @syscap SystemCapability.ArkUI.ArkUI.Full
694 * @crossplatform
695 * @atomicservice
696 * @since 11
697 * @test
698 */
699export declare function sendTouchEvent(event: TouchObject): boolean;
700
701/**
702 * Send key event.
703 *
704 * @param { KeyEvent } event - KeyEvent to be sent.
705 * @returns { boolean }
706 * @syscap SystemCapability.ArkUI.ArkUI.Full
707 * @since 9
708 * @test
709 */
710/**
711 * Send key event.
712 *
713 * @param { KeyEvent } event - KeyEvent to be sent.
714 * @returns { boolean }
715 * @syscap SystemCapability.ArkUI.ArkUI.Full
716 * @crossplatform
717 * @since 10
718 * @test
719 */
720/**
721 * Send key event.
722 *
723 * @param { KeyEvent } event - KeyEvent to be sent.
724 * @returns { boolean }
725 * @syscap SystemCapability.ArkUI.ArkUI.Full
726 * @crossplatform
727 * @atomicservice
728 * @since 11
729 * @test
730 */
731export declare function sendKeyEvent(event: KeyEvent): boolean;
732
733/**
734 * Send mouse event.
735 *
736 * @param { MouseEvent } event - MouseEvent to be sent.
737 * @returns { boolean }
738 * @syscap SystemCapability.ArkUI.ArkUI.Full
739 * @since 9
740 * @test
741 */
742/**
743 * Send mouse event.
744 *
745 * @param { MouseEvent } event - MouseEvent to be sent.
746 * @returns { boolean }
747 * @syscap SystemCapability.ArkUI.ArkUI.Full
748 * @crossplatform
749 * @since 10
750 * @test
751 */
752/**
753 * Send mouse event.
754 *
755 * @param { MouseEvent } event - MouseEvent to be sent.
756 * @returns { boolean }
757 * @syscap SystemCapability.ArkUI.ArkUI.Full
758 * @crossplatform
759 * @atomicservice
760 * @since 11
761 * @test
762 */
763export declare function sendMouseEvent(event: MouseEvent): boolean;
764
765 /**
766  * Mark moduleNamespace which loaded by dynamic-import is collectable.
767  *
768  * @param { Object } namespace - moduleNamespace to be marked.
769  * @throws { BusinessError } 401 - if type of object is not moduleNameSpace.
770  * @syscap SystemCapability.Utils.Lang
771  * @systemapi
772  * @stagemodelonly
773  * @since 10
774  */
775export declare function markModuleCollectable(namespace: Object): void;
776