• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2021 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 * @syscap SystemCapability.ArkUI.ArkUI.Full
23 * @since 7
24 */
25/**
26 * Defines the console info.
27 * @syscap SystemCapability.ArkUI.ArkUI.Full
28 * @form
29 * @since 9
30 */
31export declare class console {
32  /**
33   * Prints "debug" logs.
34   * @param message Text to print.
35   * @since 7
36   */
37  /**
38   * Prints "debug" logs.
39   * @param message Text to print.
40   * @form
41   * @since 9
42   */
43  static debug(message: string, ...arguments: any[]): void;
44
45  /**
46   * Prints "log" logs.
47   * @param message Text to print.
48   * @since 7
49   */
50  /**
51   * Prints "log" logs.
52   * @param message Text to print.
53   * @form
54   * @since 9
55   */
56  static log(message: string, ...arguments: any[]): void;
57
58  /**
59   * Prints "info" logs.
60   * @param message Text to print.
61   * @since 7
62   */
63  /**
64   * Prints "info" logs.
65   * @param message Text to print.
66   * @form
67   * @since 9
68   */
69  static info(message: string, ...arguments: any[]): void;
70
71  /**
72   * Prints "warn" logs.
73   * @param message Text to print.
74   * @since 7
75   */
76  /**
77   * Prints "warn" logs.
78   * @param message Text to print.
79   * @form
80   * @since 9
81   */
82  static warn(message: string, ...arguments: any[]): void;
83
84  /**
85   * Prints "error" logs.
86   * @param message Text to print.
87   * @since 7
88   */
89  /**
90   * Prints "error" logs.
91   * @param message Text to print.
92   * @form
93   * @since 9
94   */
95  static error(message: string, ...arguments: any[]): void;
96}
97
98/**
99 * Sets the interval for repeatedly calling a function.
100 * @syscap SystemCapability.ArkUI.ArkUI.Full
101 * @param handler Indicates the function to be called after the timer goes off. For devices of "tv", "phone, tablet", and "wearable" types, this parameter can be a function or string. For devices of "lite wearable" and "smartVision" types, this parameter must be a function.
102 * @param delay Indicates the interval between each two calls, in milliseconds. The function will be called after this delay.
103 * @param arguments Indicates additional arguments to pass to "handler" when the timer goes off.
104 * @returns Returns the timer ID.
105 * @since 7
106 */
107export declare function setInterval(handler: Function | string, delay: number, ...arguments: any[]): number;
108
109/**
110 * Sets a timer after which a function will be executed.
111 * @syscap SystemCapability.ArkUI.ArkUI.Full
112 * @param handler Indicates the function to be called after the timer goes off. For devices of "tv", "phone, tablet", and "wearable" types, this parameter can be a function or string. For devices of "lite wearable" and "smartVision" types, this parameter must be a function.
113 * @param delay Indicates the delay (in milliseconds) after which the function will be called. 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.
114 * @param arguments Indicates additional arguments to pass to "handler" when the timer goes off.
115 * @returns Returns the timer ID.
116 * @since 7
117 */
118export declare function setTimeout(handler: Function | string, delay?: number, ...arguments: any[]): number;
119
120/**
121 * Cancel the interval set by " setInterval()".
122 * @syscap SystemCapability.ArkUI.ArkUI.Full
123 * @param intervalID Indicates the timer ID returned by "setInterval()".
124 * @since 7
125 */
126export declare function clearInterval(intervalID?: number): void;
127
128/**
129 * Cancel the timer set by "setTimeout()".
130 * @syscap SystemCapability.ArkUI.ArkUI.Full
131 * @param timeoutID Indicates the timer ID returned by "setTimeout()".
132 * @since 7
133 */
134export declare function clearTimeout(timeoutID?: number): void;
135
136/**
137 * Defining syscap function.
138 * @syscap SystemCapability.ArkUI.ArkUI.Full
139 * @since 8
140 */
141export declare function canIUse(syscap: string): boolean;
142
143/**
144 * Obtains all attributes of the component with the specified ID.
145 * @param id ID of the component whose attributes are to be obtained.
146 * @since 9
147 * @test
148 */
149export declare function getInspectorByKey(id: string): string;
150
151 /**
152  * Get components tree.
153  * @since 9
154  * @test
155  */
156export declare function getInspectorTree(): Object;
157
158 /**
159  * Sends an event to the component with the specified ID.
160  * @param id ID of the component for which the event is to be sent.
161  * @param action Type of the event to be sent. The options are as follows: Click event: 10 LongClick: 11.
162  * @param params Event parameters. If there is no parameter, pass an empty string "".
163  * @since 9
164  * @test
165  */
166export declare function sendEventByKey(id: string, action: number, params: string): boolean;
167
168 /**
169  * Send touch event.
170  * @param event TouchObject to be sent.
171  * @since 9
172  * @test
173  */
174export declare function sendTouchEvent(event: TouchObject): boolean;
175
176 /**
177  * Send key event.
178  * @param event KeyEvent to be sent.
179  * @since 9
180  * @test
181  */
182export declare function sendKeyEvent(event: KeyEvent): boolean;
183
184 /**
185  * Send mouse event.
186  * @param event MouseEvent to be sent.
187  * @since 9
188  * @test
189  */
190export declare function sendMouseEvent(event: MouseEvent): boolean;
191