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 */ 41export declare class console { 42 /** 43 * Prints "debug" logs. 44 * 45 * @param { string } message - Text to print. 46 * @param { any[] } arguments 47 * @syscap SystemCapability.ArkUI.ArkUI.Full 48 * @since 7 49 */ 50 /** 51 * Prints "debug" logs. 52 * 53 * @param { string } message - Text to print. 54 * @param { any[] } arguments 55 * @syscap SystemCapability.ArkUI.ArkUI.Full 56 * @since 9 57 * @form 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 * @crossplatform 66 * @since 10 67 * @form 68 */ 69 static debug(message: string, ...arguments: any[]): void; 70 71 /** 72 * Prints "log" logs. 73 * 74 * @param { string } message - Text to print. 75 * @param { any[] } arguments 76 * @syscap SystemCapability.ArkUI.ArkUI.Full 77 * @since 7 78 */ 79 /** 80 * Prints "log" logs. 81 * 82 * @param { string } message - Text to print. 83 * @param { any[] } arguments 84 * @syscap SystemCapability.ArkUI.ArkUI.Full 85 * @since 9 86 * @form 87 */ 88 /** 89 * Prints "log" logs. 90 * 91 * @param { string } message - Text to print. 92 * @param { any[] } arguments 93 * @syscap SystemCapability.ArkUI.ArkUI.Full 94 * @crossplatform 95 * @since 10 96 * @form 97 */ 98 static log(message: string, ...arguments: any[]): void; 99 100 /** 101 * Prints "info" logs. 102 * 103 * @param { string } message - Text to print. 104 * @param { any[] } arguments 105 * @syscap SystemCapability.ArkUI.ArkUI.Full 106 * @since 7 107 */ 108 /** 109 * Prints "info" logs. 110 * 111 * @param { string } message - Text to print. 112 * @param { any[] } arguments 113 * @syscap SystemCapability.ArkUI.ArkUI.Full 114 * @since 9 115 * @form 116 */ 117 /** 118 * Prints "info" logs. 119 * 120 * @param { string } message - Text to print. 121 * @param { any[] } arguments 122 * @syscap SystemCapability.ArkUI.ArkUI.Full 123 * @crossplatform 124 * @since 10 125 * @form 126 */ 127 static info(message: string, ...arguments: any[]): void; 128 129 /** 130 * Prints "warn" logs. 131 * 132 * @param { string } message - Text to print. 133 * @param { any[] } arguments 134 * @syscap SystemCapability.ArkUI.ArkUI.Full 135 * @since 7 136 */ 137 /** 138 * Prints "warn" logs. 139 * 140 * @param { string } message - Text to print. 141 * @param { any[] } arguments 142 * @syscap SystemCapability.ArkUI.ArkUI.Full 143 * @since 9 144 * @form 145 */ 146 /** 147 * Prints "warn" logs. 148 * 149 * @param { string } message - Text to print. 150 * @param { any[] } arguments 151 * @syscap SystemCapability.ArkUI.ArkUI.Full 152 * @crossplatform 153 * @since 10 154 * @form 155 */ 156 static warn(message: string, ...arguments: any[]): void; 157 158 /** 159 * Prints "error" logs. 160 * 161 * @param { string } message - Text to print. 162 * @param { any[] } arguments 163 * @syscap SystemCapability.ArkUI.ArkUI.Full 164 * @since 7 165 */ 166 /** 167 * Prints "error" logs. 168 * 169 * @param { string } message - Text to print. 170 * @param { any[] } arguments 171 * @syscap SystemCapability.ArkUI.ArkUI.Full 172 * @since 9 173 * @form 174 */ 175 /** 176 * Prints "error" logs. 177 * 178 * @param { string } message - Text to print. 179 * @param { any[] } arguments 180 * @syscap SystemCapability.ArkUI.ArkUI.Full 181 * @crossplatform 182 * @since 10 183 * @form 184 */ 185 static error(message: string, ...arguments: any[]): void; 186 187 /** 188 * Prints a message if value is false or omitted. 189 * 190 * @param { Object } [value] - The value tested for being truthy. 191 * @param { Object[] } arguments - Used as error message to print. 192 * @throws { BusinessError } 401 - The parameter check failed. 193 * @static 194 * @syscap SystemCapability.Utils.Lang 195 * @crossplatform 196 * @since 10 197 */ 198 static assert(value?: Object, ...arguments: Object[]): void; 199 200 /** 201 * Maintains an internal counter specific to label and print the number of times 202 * console.count() has been called with the given label. 203 * 204 * @param { string } [label] - Counter name. Default: "default". 205 * @throws { BusinessError } 401 - The parameter check failed. 206 * @static 207 * @syscap SystemCapability.Utils.Lang 208 * @crossplatform 209 * @since 10 210 */ 211 static count(label?: string): void; 212 213 /** 214 * Reset the internal counter specific to label. 215 * 216 * @param { string } [label] - Counter name. Default: "default". 217 * @throws { BusinessError } 401 - The parameter check failed. 218 * @static 219 * @syscap SystemCapability.Utils.Lang 220 * @crossplatform 221 * @since 10 222 */ 223 static countReset(label?: string): void; 224 225 /** 226 * Prints properties of the specified JavaScript object. 227 * 228 * @param { Object } [dir] - A JavaScript object whose properties should be output. 229 * @static 230 * @syscap SystemCapability.Utils.Lang 231 * @crossplatform 232 * @since 10 233 */ 234 static dir(dir?: Object): void; 235 236 /** 237 * This method calls console.log() passing it the arguments received. 238 * This method does not produce any XML formatting. 239 * 240 * @param { Object[] } arguments - Text to print. 241 * @static 242 * @syscap SystemCapability.Utils.Lang 243 * @crossplatform 244 * @since 10 245 */ 246 static dirxml(...arguments: Object[]): void; 247 248 /** 249 * Creates a new inline group, causing any subsequent console messages to be indented by an additional level. 250 * 251 * @param { Object[] } arguments - messages to print first. 252 * @static 253 * @syscap SystemCapability.Utils.Lang 254 * @crossplatform 255 * @since 10 256 */ 257 static group(...arguments: Object[]): void; 258 259 /** 260 * Same as console.group() 261 * 262 * @param { Object[] } arguments - messages to print first. 263 * @static 264 * @syscap SystemCapability.Utils.Lang 265 * @crossplatform 266 * @since 10 267 */ 268 static groupCollapsed(...arguments: Object[]): void; 269 270 /** 271 * Exit current inline group. 272 * 273 * @static 274 * @syscap SystemCapability.Utils.Lang 275 * @crossplatform 276 * @since 10 277 */ 278 static groupEnd(): void; 279 280 /** 281 * Prints tabular data as a table. 282 * 283 * @param { Object } [tableData] - tabular data. 284 * @static 285 * @syscap SystemCapability.Utils.Lang 286 * @crossplatform 287 * @since 10 288 */ 289 static table(tableData?: Object): void; 290 291 /** 292 * Start a timer. 293 * 294 * @param { string } [label] - Timer name. Default: "default". 295 * @throws { BusinessError } 401 - The parameter check failed. 296 * @static 297 * @syscap SystemCapability.Utils.Lang 298 * @crossplatform 299 * @since 10 300 */ 301 static time(label?: string): void; 302 303 /** 304 * End a timer and print time duration. 305 * 306 * @param { string } [label] - Timer name. Default: "default". 307 * @throws { BusinessError } 401 - The parameter check failed. 308 * @static 309 * @syscap SystemCapability.Utils.Lang 310 * @crossplatform 311 * @since 10 312 */ 313 static timeEnd(label?: string): void; 314 315 /** 316 * Print the elapsed time and other data arguments. 317 * 318 * @param { string } [label] - Timer name. Default: "default". 319 * @param { Object[] } arguments - Text to print. 320 * @throws { BusinessError } 401 - The parameter check failed. 321 * @static 322 * @syscap SystemCapability.Utils.Lang 323 * @crossplatform 324 * @since 10 325 */ 326 static timeLog(label?: string, ...arguments: Object[]): void; 327 328 /** 329 * Prints stack information for the current code location. 330 * 331 * @param { Object[] } arguments - message to print. 332 * @static 333 * @syscap SystemCapability.Utils.Lang 334 * @crossplatform 335 * @since 10 336 */ 337 static trace(...arguments: Object[]): void; 338} 339 340/** 341 * Sets the interval for repeatedly calling a function. 342 * 343 * @param { Function | string } handler - Indicates the function to be called after the timer goes off. 344 * For devices of "tv", "phone, tablet", and "wearable" types, this parameter can be a function or string. 345 * For devices of "lite wearable" and "smartVision" types, this parameter must be a function. 346 * @param { number } delay - Indicates the interval between each two calls, in milliseconds. The function will be called after this delay. 347 * @param { any[] } arguments - Indicates additional arguments to pass to "handler" when the timer goes off. 348 * @returns { number } Returns the timer ID. 349 * @syscap SystemCapability.ArkUI.ArkUI.Full 350 * @since 7 351 */ 352/** 353 * Sets the interval for repeatedly calling a function. 354 * 355 * @param { Function | string } handler - Indicates the function to be called after the timer goes off. 356 * For devices of "tv", "phone, tablet", and "wearable" types, this parameter can be a function or string. 357 * For devices of "lite wearable" and "smartVision" types, this parameter must be a function. 358 * @param { number } delay - Indicates the interval between each two calls, in milliseconds. The function will be called after this delay. 359 * @param { any[] } arguments - Indicates additional arguments to pass to "handler" when the timer goes off. 360 * @returns { number } Returns the timer ID. 361 * @syscap SystemCapability.ArkUI.ArkUI.Full 362 * @crossplatform 363 * @since 10 364 */ 365export declare function setInterval(handler: Function | string, delay: number, ...arguments: any[]): number; 366 367/** 368 * Sets a timer after which a function will be executed. 369 * 370 * @param { Function | string } handler - Indicates the function to be called after the timer goes off. 371 * For devices of "tv", "phone, tablet", and "wearable" types, this parameter can be a function or string. 372 * For devices of "lite wearable" and "smartVision" types, this parameter must be a function. 373 * @param { number } [delay] - Indicates the delay (in milliseconds) after which the function will be called. 374 * 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. 375 * @param { any[] } arguments - Indicates additional arguments to pass to "handler" when the timer goes off. 376 * @returns { number } Returns the timer ID. 377 * @syscap SystemCapability.ArkUI.ArkUI.Full 378 * @since 7 379 */ 380/** 381 * Sets a timer after which a function will be executed. 382 * 383 * @param { Function | string } handler - Indicates the function to be called after the timer goes off. 384 * For devices of "tv", "phone, tablet", and "wearable" types, this parameter can be a function or string. 385 * For devices of "lite wearable" and "smartVision" types, this parameter must be a function. 386 * @param { number } [delay] - Indicates the delay (in milliseconds) after which the function will be called. 387 * 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. 388 * @param { any[] } [arguments] - Indicates additional arguments to pass to "handler" when the timer goes off. 389 * @returns { number } Returns the timer ID. 390 * @syscap SystemCapability.ArkUI.ArkUI.Full 391 * @crossplatform 392 * @since 10 393 */ 394export declare function setTimeout(handler: Function | string, delay?: number, ...arguments: any[]): number; 395 396/** 397 * Cancel the interval set by " setInterval()". 398 * 399 * @param { number } [intervalID] - Indicates the timer ID returned by "setInterval()". 400 * @syscap SystemCapability.ArkUI.ArkUI.Full 401 * @since 7 402 */ 403/** 404 * Cancel the interval set by " setInterval()". 405 * 406 * @param { number } [intervalID] - Indicates the timer ID returned by "setInterval()". 407 * @syscap SystemCapability.ArkUI.ArkUI.Full 408 * @crossplatform 409 * @since 10 410 */ 411export declare function clearInterval(intervalID?: number): void; 412 413/** 414 * Cancel the timer set by "setTimeout()". 415 * 416 * @param { number } [timeoutID] - Indicates the timer ID returned by "setTimeout()". 417 * @syscap SystemCapability.ArkUI.ArkUI.Full 418 * @since 7 419 */ 420/** 421 * Cancel the timer set by "setTimeout()". 422 * 423 * @param { number } [timeoutID] - Indicates the timer ID returned by "setTimeout()". 424 * @syscap SystemCapability.ArkUI.ArkUI.Full 425 * @crossplatform 426 * @since 10 427 */ 428export declare function clearTimeout(timeoutID?: number): void; 429 430/** 431 * Defining syscap function. 432 * 433 * @param { string } syscap 434 * @returns { boolean } 435 * @syscap SystemCapability.ArkUI.ArkUI.Full 436 * @since 8 437 */ 438/** 439 * Defining syscap function. 440 * 441 * @param { string } syscap 442 * @returns { boolean } 443 * @syscap SystemCapability.ArkUI.ArkUI.Full 444 * @crossplatform 445 * @since 10 446 */ 447export declare function canIUse(syscap: string): boolean; 448 449/** 450 * Obtains all attributes of the component with the specified ID. 451 * 452 * @param { string } id - ID of the component whose attributes are to be obtained. 453 * @returns { string } 454 * @syscap SystemCapability.ArkUI.ArkUI.Full 455 * @since 9 456 * @test 457 */ 458/** 459 * Obtains all attributes of the component with the specified ID. 460 * 461 * @param { string } id - ID of the component whose attributes are to be obtained. 462 * @returns { string } 463 * @syscap SystemCapability.ArkUI.ArkUI.Full 464 * @crossplatform 465 * @since 10 466 * @test 467 */ 468export declare function getInspectorByKey(id: string): string; 469 470/** 471 * Get components tree. 472 * 473 * @returns { Object } 474 * @syscap SystemCapability.ArkUI.ArkUI.Full 475 * @since 9 476 * @test 477 */ 478/** 479 * Get components tree. 480 * 481 * @returns { Object } 482 * @syscap SystemCapability.ArkUI.ArkUI.Full 483 * @crossplatform 484 * @since 10 485 * @test 486 */ 487export declare function getInspectorTree(): Object; 488 489/** 490 * Sends an event to the component with the specified ID. 491 * 492 * @param { string } id - ID of the component for which the event is to be sent. 493 * @param { number } action - Type of the event to be sent. The options are as follows: Click event: 10 LongClick: 11. 494 * @param { string } params - Event parameters. If there is no parameter, pass an empty string "". 495 * @returns { boolean } 496 * @syscap SystemCapability.ArkUI.ArkUI.Full 497 * @since 9 498 * @test 499 */ 500/** 501 * Sends an event to the component with the specified ID. 502 * 503 * @param { string } id - ID of the component for which the event is to be sent. 504 * @param { number } action - Type of the event to be sent. The options are as follows: Click event: 10 LongClick: 11. 505 * @param { string } params - Event parameters. If there is no parameter, pass an empty string "". 506 * @returns { boolean } 507 * @syscap SystemCapability.ArkUI.ArkUI.Full 508 * @crossplatform 509 * @since 10 510 * @test 511 */ 512export declare function sendEventByKey(id: string, action: number, params: string): boolean; 513 514/** 515 * Send touch event. 516 * 517 * @param { TouchObject } event - TouchObject to be sent. 518 * @returns { boolean } 519 * @syscap SystemCapability.ArkUI.ArkUI.Full 520 * @since 9 521 * @test 522 */ 523/** 524 * Send touch event. 525 * 526 * @param { TouchObject } event - TouchObject to be sent. 527 * @returns { boolean } 528 * @syscap SystemCapability.ArkUI.ArkUI.Full 529 * @crossplatform 530 * @since 10 531 * @test 532 */ 533export declare function sendTouchEvent(event: TouchObject): boolean; 534 535/** 536 * Send key event. 537 * 538 * @param { KeyEvent } event - KeyEvent to be sent. 539 * @returns { boolean } 540 * @syscap SystemCapability.ArkUI.ArkUI.Full 541 * @since 9 542 * @test 543 */ 544/** 545 * Send key event. 546 * 547 * @param { KeyEvent } event - KeyEvent to be sent. 548 * @returns { boolean } 549 * @syscap SystemCapability.ArkUI.ArkUI.Full 550 * @crossplatform 551 * @since 10 552 * @test 553 */ 554export declare function sendKeyEvent(event: KeyEvent): boolean; 555 556/** 557 * Send mouse event. 558 * 559 * @param { MouseEvent } event - MouseEvent to be sent. 560 * @returns { boolean } 561 * @syscap SystemCapability.ArkUI.ArkUI.Full 562 * @since 9 563 * @test 564 */ 565/** 566 * Send mouse event. 567 * 568 * @param { MouseEvent } event - MouseEvent to be sent. 569 * @returns { boolean } 570 * @syscap SystemCapability.ArkUI.ArkUI.Full 571 * @crossplatform 572 * @since 10 573 * @test 574 */ 575export declare function sendMouseEvent(event: MouseEvent): boolean; 576 577 /** 578 * Mark moduleNamespace which loaded by dynamic-import is collectable. 579 * 580 * @param { Object } namespace - moduleNamespace to be marked. 581 * @throws { BusinessError } 401 - if type of object is not moduleNameSpace. 582 * @syscap SystemCapability.Utils.Lang 583 * @systemapi 584 * @stagemodelonly 585 * @since 10 586 */ 587export declare function markModuleCollectable(namespace: Object): void; 588