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