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/** 17 * @file 18 * @kit ArkUI 19 */ 20 21import { TouchObject, KeyEvent, MouseEvent } from '../../../api/arkui/component/common'; 22 23/** 24 * Sets the interval for repeatedly calling a function. 25 * 26 * @param { Function | string } handler - Indicates the function to be called after the timer goes off. 27 * For devices of "tv", "phone, tablet", and "wearable" types, this parameter can be a function or string. 28 * For devices of "lite wearable" and "smartVision" types, this parameter must be a function. 29 * @param { number } delay - Indicates the interval between each two calls, in milliseconds. The function will be called after this delay. 30 * @param { any[] } arguments - Indicates additional arguments to pass to "handler" when the timer goes off. 31 * @returns { number } Returns the timer ID. 32 * @syscap SystemCapability.ArkUI.ArkUI.Full 33 * @since 7 34 */ 35/** 36 * Sets the interval for repeatedly calling a function. 37 * 38 * @param { Function | string } handler - Indicates the function to be called after the timer goes off. 39 * For devices of "tv", "phone, tablet", and "wearable" types, this parameter can be a function or string. 40 * For devices of "lite wearable" and "smartVision" types, this parameter must be a function. 41 * @param { number } delay - Indicates the interval between each two calls, in milliseconds. The function will be called after this delay. 42 * @param { any[] } arguments - Indicates additional arguments to pass to "handler" when the timer goes off. 43 * @returns { number } Returns the timer ID. 44 * @syscap SystemCapability.ArkUI.ArkUI.Full 45 * @crossplatform 46 * @since 10 47 */ 48/** 49 * Sets the interval for repeatedly calling a function. 50 * 51 * @param { Function | string } handler - Indicates the function to be called after the timer goes off. 52 * For devices of "tv", "phone, tablet", and "wearable" types, this parameter can be a function or string. 53 * For devices of "lite wearable" and "smartVision" types, this parameter must be a function. 54 * @param { number } delay - Indicates the interval between each two calls, in milliseconds. The function will be called after this delay. 55 * @param { any[] } arguments - Indicates additional arguments to pass to "handler" when the timer goes off. 56 * @returns { number } Returns the timer ID. 57 * @syscap SystemCapability.ArkUI.ArkUI.Full 58 * @crossplatform 59 * @atomicservice 60 * @since 11 61 */ 62export declare function setInterval(func: () => void, delay: int): int; 63 64/** 65 * Sets a timer after which a function will be executed. 66 * 67 * @param { Function | string } handler - Indicates the function to be called after the timer goes off. 68 * For devices of "tv", "phone, tablet", and "wearable" types, this parameter can be a function or string. 69 * For devices of "lite wearable" and "smartVision" types, this parameter must be a function. 70 * @param { number } [delay] - Indicates the delay (in milliseconds) after which the function will be called. 71 * 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. 72 * @param { any[] } arguments - Indicates additional arguments to pass to "handler" when the timer goes off. 73 * @returns { number } Returns the timer ID. 74 * @syscap SystemCapability.ArkUI.ArkUI.Full 75 * @since 7 76 */ 77/** 78 * Sets a timer after which a function will be executed. 79 * 80 * @param { Function | string } handler - Indicates the function to be called after the timer goes off. 81 * For devices of "tv", "phone, tablet", and "wearable" types, this parameter can be a function or string. 82 * For devices of "lite wearable" and "smartVision" types, this parameter must be a function. 83 * @param { number } [delay] - Indicates the delay (in milliseconds) after which the function will be called. 84 * 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. 85 * @param { any[] } [arguments] - Indicates additional arguments to pass to "handler" when the timer goes off. 86 * @returns { number } Returns the timer ID. 87 * @syscap SystemCapability.ArkUI.ArkUI.Full 88 * @crossplatform 89 * @since 10 90 */ 91/** 92 * Sets a timer after which a function will be executed. 93 * 94 * @param { Function | string } handler - Indicates the function to be called after the timer goes off. 95 * For devices of "tv", "phone, tablet", and "wearable" types, this parameter can be a function or string. 96 * For devices of "lite wearable" and "smartVision" types, this parameter must be a function. 97 * @param { number } [delay] - Indicates the delay (in milliseconds) after which the function will be called. 98 * 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. 99 * @param { any[] } [arguments] - Indicates additional arguments to pass to "handler" when the timer goes off. 100 * @returns { number } Returns the timer ID. 101 * @syscap SystemCapability.ArkUI.ArkUI.Full 102 * @crossplatform 103 * @atomicservice 104 * @since 11 105 */ 106export declare function setTimeout(func: () => void, delay?: int): int; 107 108/** 109 * Cancel the interval set by " setInterval()". 110 * 111 * @param { number } [intervalID] - Indicates the timer ID returned by "setInterval()". 112 * @syscap SystemCapability.ArkUI.ArkUI.Full 113 * @since 7 114 */ 115/** 116 * Cancel the interval set by " setInterval()". 117 * 118 * @param { number } [intervalID] - Indicates the timer ID returned by "setInterval()". 119 * @syscap SystemCapability.ArkUI.ArkUI.Full 120 * @crossplatform 121 * @since 10 122 */ 123/** 124 * Cancel the interval set by " setInterval()". 125 * 126 * @param { number } [intervalID] - Indicates the timer ID returned by "setInterval()". 127 * @syscap SystemCapability.ArkUI.ArkUI.Full 128 * @crossplatform 129 * @atomicservice 130 * @since 11 131 */ 132export declare function clearInterval(intervalID: int): void; 133 134/** 135 * Cancel the timer set by "setTimeout()". 136 * 137 * @param { number } [timeoutID] - Indicates the timer ID returned by "setTimeout()". 138 * @syscap SystemCapability.ArkUI.ArkUI.Full 139 * @since 7 140 */ 141/** 142 * Cancel the timer set by "setTimeout()". 143 * 144 * @param { number } [timeoutID] - Indicates the timer ID returned by "setTimeout()". 145 * @syscap SystemCapability.ArkUI.ArkUI.Full 146 * @crossplatform 147 * @since 10 148 */ 149/** 150 * Cancel the timer set by "setTimeout()". 151 * 152 * @param { number } [timeoutID] - Indicates the timer ID returned by "setTimeout()". 153 * @syscap SystemCapability.ArkUI.ArkUI.Full 154 * @crossplatform 155 * @atomicservice 156 * @since 11 157 */ 158export declare function clearTimeout(timeoutID: int): void; 159 160/** 161 * Defining syscap function. 162 * 163 * @param { string } syscap 164 * @returns { boolean } 165 * @syscap SystemCapability.ArkUI.ArkUI.Full 166 * @since 8 167 */ 168/** 169 * Defining syscap function. 170 * 171 * @param { string } syscap 172 * @returns { boolean } 173 * @syscap SystemCapability.ArkUI.ArkUI.Full 174 * @crossplatform 175 * @since 10 176 */ 177/** 178 * Defining syscap function. 179 * 180 * @param { string } syscap 181 * @returns { boolean } 182 * @syscap SystemCapability.ArkUI.ArkUI.Full 183 * @crossplatform 184 * @atomicservice 185 * @since 11 186 */ 187export declare function canIUse(syscap: string): boolean; 188 189/** 190 * Obtains all attributes of the component with the specified ID. 191 * 192 * @param { string } id - ID of the component whose attributes are to be obtained. 193 * @returns { string } 194 * @syscap SystemCapability.ArkUI.ArkUI.Full 195 * @since 9 196 * @test 197 */ 198/** 199 * Obtains all attributes of the component with the specified ID. 200 * 201 * @param { string } id - ID of the component whose attributes are to be obtained. 202 * @returns { string } 203 * @syscap SystemCapability.ArkUI.ArkUI.Full 204 * @crossplatform 205 * @since 10 206 * @test 207 */ 208/** 209 * Obtains all attributes of the component with the specified ID. 210 * 211 * @param { string } id - ID of the component whose attributes are to be obtained. 212 * @returns { string } 213 * @syscap SystemCapability.ArkUI.ArkUI.Full 214 * @crossplatform 215 * @atomicservice 216 * @since 11 217 * @test 218 */ 219export declare function getInspectorByKey(id: string): string; 220 221/** 222 * Get components tree. 223 * 224 * @returns { Object } 225 * @syscap SystemCapability.ArkUI.ArkUI.Full 226 * @since 9 227 * @test 228 */ 229/** 230 * Get components tree. 231 * 232 * @returns { Object } 233 * @syscap SystemCapability.ArkUI.ArkUI.Full 234 * @crossplatform 235 * @since 10 236 * @test 237 */ 238/** 239 * Get components tree. 240 * 241 * @returns { Object } 242 * @syscap SystemCapability.ArkUI.ArkUI.Full 243 * @crossplatform 244 * @atomicservice 245 * @since 11 246 * @test 247 */ 248export declare function getInspectorTree(): Object; 249 250/** 251 * Sends an event to the component with the specified ID. 252 * 253 * @param { string } id - ID of the component for which the event is to be sent. 254 * @param { number } action - Type of the event to be sent. The options are as follows: Click event: 10 LongClick: 11. 255 * @param { string } params - Event parameters. If there is no parameter, pass an empty string "". 256 * @returns { boolean } 257 * @syscap SystemCapability.ArkUI.ArkUI.Full 258 * @since 9 259 * @test 260 */ 261/** 262 * Sends an event to the component with the specified ID. 263 * 264 * @param { string } id - ID of the component for which the event is to be sent. 265 * @param { number } action - Type of the event to be sent. The options are as follows: Click event: 10 LongClick: 11. 266 * @param { string } params - Event parameters. If there is no parameter, pass an empty string "". 267 * @returns { boolean } 268 * @syscap SystemCapability.ArkUI.ArkUI.Full 269 * @crossplatform 270 * @since 10 271 * @test 272 */ 273/** 274 * Sends an event to the component with the specified ID. 275 * 276 * @param { string } id - ID of the component for which the event is to be sent. 277 * @param { number } action - Type of the event to be sent. The options are as follows: Click event: 10 LongClick: 11. 278 * @param { string } params - Event parameters. If there is no parameter, pass an empty string "". 279 * @returns { boolean } 280 * @syscap SystemCapability.ArkUI.ArkUI.Full 281 * @crossplatform 282 * @atomicservice 283 * @since 11 284 * @test 285 */ 286export declare function sendEventByKey(id: string, action: number, params: string): boolean; 287 288/** 289 * Send touch event. 290 * 291 * @param { TouchObject } event - TouchObject to be sent. 292 * @returns { boolean } 293 * @syscap SystemCapability.ArkUI.ArkUI.Full 294 * @since 9 295 * @test 296 */ 297/** 298 * Send touch event. 299 * 300 * @param { TouchObject } event - TouchObject to be sent. 301 * @returns { boolean } 302 * @syscap SystemCapability.ArkUI.ArkUI.Full 303 * @crossplatform 304 * @since 10 305 * @test 306 */ 307/** 308 * Send touch event. 309 * 310 * @param { TouchObject } event - TouchObject to be sent. 311 * @returns { boolean } 312 * @syscap SystemCapability.ArkUI.ArkUI.Full 313 * @crossplatform 314 * @atomicservice 315 * @since 11 316 * @test 317 */ 318export declare function sendTouchEvent(event: TouchObject): boolean; 319 320/** 321 * Send key event. 322 * 323 * @param { KeyEvent } event - KeyEvent to be sent. 324 * @returns { boolean } 325 * @syscap SystemCapability.ArkUI.ArkUI.Full 326 * @since 9 327 * @test 328 */ 329/** 330 * Send key event. 331 * 332 * @param { KeyEvent } event - KeyEvent to be sent. 333 * @returns { boolean } 334 * @syscap SystemCapability.ArkUI.ArkUI.Full 335 * @crossplatform 336 * @since 10 337 * @test 338 */ 339/** 340 * Send key event. 341 * 342 * @param { KeyEvent } event - KeyEvent to be sent. 343 * @returns { boolean } 344 * @syscap SystemCapability.ArkUI.ArkUI.Full 345 * @crossplatform 346 * @atomicservice 347 * @since 11 348 * @test 349 */ 350export declare function sendKeyEvent(event: KeyEvent): boolean; 351 352/** 353 * Send mouse event. 354 * 355 * @param { MouseEvent } event - MouseEvent to be sent. 356 * @returns { boolean } 357 * @syscap SystemCapability.ArkUI.ArkUI.Full 358 * @since 9 359 * @test 360 */ 361/** 362 * Send mouse event. 363 * 364 * @param { MouseEvent } event - MouseEvent to be sent. 365 * @returns { boolean } 366 * @syscap SystemCapability.ArkUI.ArkUI.Full 367 * @crossplatform 368 * @since 10 369 * @test 370 */ 371/** 372 * Send mouse event. 373 * 374 * @param { MouseEvent } event - MouseEvent to be sent. 375 * @returns { boolean } 376 * @syscap SystemCapability.ArkUI.ArkUI.Full 377 * @crossplatform 378 * @atomicservice 379 * @since 11 380 * @test 381 */ 382export declare function sendMouseEvent(event: MouseEvent): boolean; 383