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 21/** 22 * Provides a way to control the process. 23 * 24 * @since 8 25 */ 26/** 27 * Provides a way to control the process. 28 * 29 * @syscap SystemCapability.ArkUI.ArkUI.Full 30 * @crossplatform 31 * @form 32 * @since 10 33 */ 34/** 35 * Provides a way to control the process. 36 * 37 * @syscap SystemCapability.ArkUI.ArkUI.Full 38 * @crossplatform 39 * @form 40 * @atomicservice 41 * @since 11 42 */ 43declare class TextTimerController { 44 /** 45 * constructor. 46 * 47 * @syscap SystemCapability.ArkUI.ArkUI.Full 48 * @since 8 49 */ 50 /** 51 * constructor. 52 * 53 * @syscap SystemCapability.ArkUI.ArkUI.Full 54 * @crossplatform 55 * @form 56 * @since 10 57 */ 58 /** 59 * constructor. 60 * 61 * @syscap SystemCapability.ArkUI.ArkUI.Full 62 * @crossplatform 63 * @form 64 * @atomicservice 65 * @since 11 66 */ 67 constructor(); 68 69 /** 70 * Provides a start event for timer. 71 * 72 * @syscap SystemCapability.ArkUI.ArkUI.Full 73 * @since 8 74 */ 75 /** 76 * Provides a start event for timer. 77 * 78 * @syscap SystemCapability.ArkUI.ArkUI.Full 79 * @crossplatform 80 * @form 81 * @since 10 82 */ 83 /** 84 * Provides a start event for timer. 85 * 86 * @syscap SystemCapability.ArkUI.ArkUI.Full 87 * @crossplatform 88 * @form 89 * @atomicservice 90 * @since 11 91 */ 92 start(); 93 94 /** 95 * Provides a pause event for timer. 96 * 97 * @syscap SystemCapability.ArkUI.ArkUI.Full 98 * @since 8 99 */ 100 /** 101 * Provides a pause event for timer. 102 * 103 * @syscap SystemCapability.ArkUI.ArkUI.Full 104 * @crossplatform 105 * @form 106 * @since 10 107 */ 108 /** 109 * Provides a pause event for timer. 110 * 111 * @syscap SystemCapability.ArkUI.ArkUI.Full 112 * @crossplatform 113 * @form 114 * @atomicservice 115 * @since 11 116 */ 117 pause(); 118 119 /** 120 * Provides an event to reset timer. 121 * 122 * @syscap SystemCapability.ArkUI.ArkUI.Full 123 * @since 8 124 */ 125 /** 126 * Provides an event to reset timer. 127 * 128 * @syscap SystemCapability.ArkUI.ArkUI.Full 129 * @crossplatform 130 * @form 131 * @since 10 132 */ 133 /** 134 * Provides an event to reset timer. 135 * 136 * @syscap SystemCapability.ArkUI.ArkUI.Full 137 * @crossplatform 138 * @form 139 * @atomicservice 140 * @since 11 141 */ 142 reset(); 143} 144 145/** 146 * TextTimerConfiguration used by content modifier. 147 * 148 * @extends CommonConfiguration<TextTimerConfiguration> 149 * @interface TextTimerConfiguration 150 * @syscap SystemCapability.ArkUI.ArkUI.Full 151 * @crossplatform 152 * @atomicservice 153 * @since 12 154 */ 155declare interface TextTimerConfiguration extends CommonConfiguration<TextTimerConfiguration> { 156 /** 157 * Specifies the timer range. 158 * In the non-countDown scenario, a negative value indicates that the timer is not limited. 159 * The unit is millisecond. 160 * 161 * @type { number } 162 * @syscap SystemCapability.ArkUI.ArkUI.Full 163 * @crossplatform 164 * @atomicservice 165 * @since 12 166 */ 167 count: number; 168 169 /** 170 * Texttimer is isCountDown or not. 171 * 172 * @type { boolean } 173 * @syscap SystemCapability.ArkUI.ArkUI.Full 174 * @crossplatform 175 * @atomicservice 176 * @since 12 177 */ 178 isCountDown: boolean; 179 180 /** 181 * Texttimer is started or not. 182 * 183 * @type { boolean } 184 * @syscap SystemCapability.ArkUI.ArkUI.Full 185 * @crossplatform 186 * @atomicservice 187 * @since 12 188 */ 189 started: boolean; 190 191 /** 192 * Elapsed time of the timer, readonly. 193 * The unit is millisecond. 194 * 195 * @type { number } 196 * @syscap SystemCapability.ArkUI.ArkUI.Full 197 * @crossplatform 198 * @atomicservice 199 * @since 12 200 */ 201 elapsedTime: number; 202} 203 204/** 205 * Defines the options of TextTimer. 206 * 207 * @interface TextTimerOptions 208 * @syscap SystemCapability.ArkUI.ArkUI.Full 209 * @since 8 210 */ 211/** 212 * Defines the options of TextTimer. 213 * 214 * @interface TextTimerOptions 215 * @syscap SystemCapability.ArkUI.ArkUI.Full 216 * @crossplatform 217 * @form 218 * @since 10 219 */ 220/** 221 * Defines the options of TextTimer. 222 * 223 * @interface TextTimerOptions 224 * @syscap SystemCapability.ArkUI.ArkUI.Full 225 * @crossplatform 226 * @form 227 * @atomicservice 228 * @since 11 229 */ 230interface TextTimerOptions { 231 /** 232 * Sets whether to countdown.The default value is false. 233 * 234 * @type { ?boolean } 235 * @syscap SystemCapability.ArkUI.ArkUI.Full 236 * @since 8 237 */ 238 /** 239 * Sets whether to countdown.The default value is false. 240 * 241 * @type { ?boolean } 242 * @syscap SystemCapability.ArkUI.ArkUI.Full 243 * @crossplatform 244 * @form 245 * @since 10 246 */ 247 /** 248 * Sets whether to countdown.The default value is false. 249 * 250 * @type { ?boolean } 251 * @syscap SystemCapability.ArkUI.ArkUI.Full 252 * @crossplatform 253 * @form 254 * @atomicservice 255 * @since 11 256 */ 257 isCountDown?: boolean; 258 259 /** 260 * Specifies the timer range. 261 * In the non-countDown scenario, a negative value indicates that the timer is not limited. 262 * The unit is millisecond. 263 * 264 * @type { ?number } 265 * @syscap SystemCapability.ArkUI.ArkUI.Full 266 * @since 8 267 */ 268 /** 269 * Specifies the timer range. 270 * In the non-countDown scenario, a negative value indicates that the timer is not limited. 271 * The unit is millisecond. 272 * 273 * @type { ?number } 274 * @syscap SystemCapability.ArkUI.ArkUI.Full 275 * @crossplatform 276 * @form 277 * @since 10 278 */ 279 /** 280 * Specifies the timer range. 281 * In the non-countDown scenario, a negative value indicates that the timer is not limited. 282 * The unit is millisecond. 283 * 284 * @type { ?number } 285 * @syscap SystemCapability.ArkUI.ArkUI.Full 286 * @crossplatform 287 * @form 288 * @atomicservice 289 * @since 11 290 */ 291 count?: number; 292 293 /** 294 * Controller of Texttimer. 295 * 296 * @type { ?TextTimerController } 297 * @syscap SystemCapability.ArkUI.ArkUI.Full 298 * @since 8 299 */ 300 /** 301 * Controller of Texttimer. 302 * 303 * @type { ?TextTimerController } 304 * @syscap SystemCapability.ArkUI.ArkUI.Full 305 * @crossplatform 306 * @form 307 * @since 10 308 */ 309 /** 310 * Controller of Texttimer. 311 * 312 * @type { ?TextTimerController } 313 * @syscap SystemCapability.ArkUI.ArkUI.Full 314 * @crossplatform 315 * @form 316 * @atomicservice 317 * @since 11 318 */ 319 controller?: TextTimerController; 320} 321 322/** 323 * Provides an interface for texttimer containers. 324 * 325 * @interface TextTimerInterface 326 * @syscap SystemCapability.ArkUI.ArkUI.Full 327 * @since 8 328 */ 329/** 330 * Provides an interface for texttimer containers. 331 * 332 * @interface TextTimerInterface 333 * @syscap SystemCapability.ArkUI.ArkUI.Full 334 * @crossplatform 335 * @form 336 * @since 10 337 */ 338/** 339 * Provides an interface for texttimer containers. 340 * 341 * @interface TextTimerInterface 342 * @syscap SystemCapability.ArkUI.ArkUI.Full 343 * @crossplatform 344 * @form 345 * @atomicservice 346 * @since 11 347 */ 348interface TextTimerInterface { 349 /** 350 * Defines the TextTimer constructor. 351 * 352 * @param { TextTimerOptions } options 353 * @returns { TextTimerAttribute } 354 * @syscap SystemCapability.ArkUI.ArkUI.Full 355 * @since 8 356 */ 357 /** 358 * Defines the TextTimer constructor. 359 * 360 * @param { TextTimerOptions } options 361 * @returns { TextTimerAttribute } 362 * @syscap SystemCapability.ArkUI.ArkUI.Full 363 * @crossplatform 364 * @form 365 * @since 10 366 */ 367 /** 368 * Defines the TextTimer constructor. 369 * 370 * @param { TextTimerOptions } options 371 * @returns { TextTimerAttribute } 372 * @syscap SystemCapability.ArkUI.ArkUI.Full 373 * @crossplatform 374 * @form 375 * @atomicservice 376 * @since 11 377 */ 378 (options?: TextTimerOptions): TextTimerAttribute; 379} 380 381/** 382 * Defines the TextTimer attribute functions. 383 * 384 * @extends CommonMethod<TextTimerAttribute> 385 * @since 8 386 */ 387/** 388 * Defines the TextTimer attribute functions. 389 * 390 * @extends CommonMethod<TextTimerAttribute> 391 * @syscap SystemCapability.ArkUI.ArkUI.Full 392 * @crossplatform 393 * @form 394 * @since 10 395 */ 396/** 397 * Defines the TextTimer attribute functions. 398 * 399 * @extends CommonMethod<TextTimerAttribute> 400 * @syscap SystemCapability.ArkUI.ArkUI.Full 401 * @crossplatform 402 * @form 403 * @atomicservice 404 * @since 11 405 */ 406declare class TextTimerAttribute extends CommonMethod<TextTimerAttribute> { 407 /** 408 * Set the display time format, for example, now is hh/mm/ss/ms and current: hh-mm-ss-ms. 409 * The time format string can be hh, mm, ss, or ms. 410 * 411 * @param { string } value 412 * @returns { TextTimerAttribute } 413 * @syscap SystemCapability.ArkUI.ArkUI.Full 414 * @since 8 415 */ 416 /** 417 * Set the display time format, for example, now is hh/mm/ss/ms and current: hh-mm-ss-ms. 418 * The time format string can be hh, mm, ss, or ms. 419 * 420 * @param { string } value 421 * @returns { TextTimerAttribute } 422 * @syscap SystemCapability.ArkUI.ArkUI.Full 423 * @crossplatform 424 * @form 425 * @since 10 426 */ 427 /** 428 * Set the display time format, for example, now is hh/mm/ss/ms and current: hh-mm-ss-ms. 429 * The time format string can be hh, mm, ss, or ms. 430 * 431 * @param { string } value 432 * @returns { TextTimerAttribute } 433 * @syscap SystemCapability.ArkUI.ArkUI.Full 434 * @crossplatform 435 * @form 436 * @atomicservice 437 * @since 11 438 */ 439 format(value: string): TextTimerAttribute; 440 441 /** 442 * Called when the font color is set. 443 * 444 * @param { ResourceColor } value 445 * @returns { TextTimerAttribute } 446 * @syscap SystemCapability.ArkUI.ArkUI.Full 447 * @since 8 448 */ 449 /** 450 * Called when the font color is set. 451 * 452 * @param { ResourceColor } value 453 * @returns { TextTimerAttribute } 454 * @syscap SystemCapability.ArkUI.ArkUI.Full 455 * @crossplatform 456 * @form 457 * @since 10 458 */ 459 /** 460 * Called when the font color is set. 461 * 462 * @param { ResourceColor } value 463 * @returns { TextTimerAttribute } 464 * @syscap SystemCapability.ArkUI.ArkUI.Full 465 * @crossplatform 466 * @form 467 * @atomicservice 468 * @since 11 469 */ 470 fontColor(value: ResourceColor): TextTimerAttribute; 471 472 /** 473 * Called when the font size is set. 474 * 475 * @param { Length } value 476 * @returns { TextTimerAttribute } 477 * @syscap SystemCapability.ArkUI.ArkUI.Full 478 * @since 8 479 */ 480 /** 481 * Called when the font size is set. 482 * 483 * @param { Length } value 484 * @returns { TextTimerAttribute } 485 * @syscap SystemCapability.ArkUI.ArkUI.Full 486 * @crossplatform 487 * @form 488 * @since 10 489 */ 490 /** 491 * Called when the font size is set. 492 * 493 * @param { Length } value 494 * @returns { TextTimerAttribute } 495 * @syscap SystemCapability.ArkUI.ArkUI.Full 496 * @crossplatform 497 * @form 498 * @atomicservice 499 * @since 11 500 */ 501 fontSize(value: Length): TextTimerAttribute; 502 503 /** 504 * Called when the fontStyle is set 505 * 506 * @param { FontStyle } value 507 * @returns { TextTimerAttribute } 508 * @syscap SystemCapability.ArkUI.ArkUI.Full 509 * @since 8 510 */ 511 /** 512 * Called when the fontStyle is set 513 * 514 * @param { FontStyle } value 515 * @returns { TextTimerAttribute } 516 * @syscap SystemCapability.ArkUI.ArkUI.Full 517 * @crossplatform 518 * @form 519 * @since 10 520 */ 521 /** 522 * Called when the fontStyle is set 523 * 524 * @param { FontStyle } value 525 * @returns { TextTimerAttribute } 526 * @syscap SystemCapability.ArkUI.ArkUI.Full 527 * @crossplatform 528 * @form 529 * @atomicservice 530 * @since 11 531 */ 532 fontStyle(value: FontStyle): TextTimerAttribute; 533 534 /** 535 * Called when the fontWeight is set 536 * 537 * @param { number | FontWeight | string } value 538 * @returns { TextTimerAttribute } 539 * @syscap SystemCapability.ArkUI.ArkUI.Full 540 * @since 8 541 */ 542 /** 543 * Called when the fontWeight is set 544 * 545 * @param { number | FontWeight | string } value 546 * @returns { TextTimerAttribute } 547 * @syscap SystemCapability.ArkUI.ArkUI.Full 548 * @crossplatform 549 * @form 550 * @since 10 551 */ 552 /** 553 * Called when the fontWeight is set 554 * 555 * @param { number | FontWeight | string } value 556 * @returns { TextTimerAttribute } 557 * @syscap SystemCapability.ArkUI.ArkUI.Full 558 * @crossplatform 559 * @form 560 * @atomicservice 561 * @since 11 562 */ 563 fontWeight(value: number | FontWeight | string): TextTimerAttribute; 564 565 /** 566 * Called when the fontFamily is set 567 * 568 * @param { ResourceStr } value 569 * @returns { TextTimerAttribute } 570 * @syscap SystemCapability.ArkUI.ArkUI.Full 571 * @since 8 572 */ 573 /** 574 * Called when the fontFamily is set 575 * 576 * @param { ResourceStr } value 577 * @returns { TextTimerAttribute } 578 * @syscap SystemCapability.ArkUI.ArkUI.Full 579 * @crossplatform 580 * @form 581 * @since 10 582 */ 583 /** 584 * Called when the fontFamily is set 585 * 586 * @param { ResourceStr } value 587 * @returns { TextTimerAttribute } 588 * @syscap SystemCapability.ArkUI.ArkUI.Full 589 * @crossplatform 590 * @form 591 * @atomicservice 592 * @since 11 593 */ 594 fontFamily(value: ResourceStr): TextTimerAttribute; 595 596 /** 597 * Called when the timer value is returned. 598 * 599 * @param { function } event 600 * @returns { TextTimerAttribute } 601 * @syscap SystemCapability.ArkUI.ArkUI.Full 602 * @since 8 603 */ 604 /** 605 * Called when the timer value is returned. 606 * 607 * @param { function } event 608 * @returns { TextTimerAttribute } 609 * @syscap SystemCapability.ArkUI.ArkUI.Full 610 * @crossplatform 611 * @form 612 * @since 10 613 */ 614 /** 615 * Called when the timer value is returned. 616 * 617 * @param { function } event 618 * @returns { TextTimerAttribute } 619 * @syscap SystemCapability.ArkUI.ArkUI.Full 620 * @crossplatform 621 * @form 622 * @atomicservice 623 * @since 11 624 */ 625 onTimer(event: (utc: number, elapsedTime: number) => void): TextTimerAttribute; 626 627 /** 628 * Called when the text shadow is set. 629 * 630 * @param { ShadowOptions | Array<ShadowOptions> } value - The shadow options. 631 * @returns { TextTimerAttribute } 632 * @syscap SystemCapability.ArkUI.ArkUI.Full 633 * @crossplatform 634 * @since 11 635 */ 636 /** 637 * Called when the text shadow is set. 638 * 639 * @param { ShadowOptions | Array<ShadowOptions> } value - The shadow options. 640 * @returns { TextTimerAttribute } 641 * @syscap SystemCapability.ArkUI.ArkUI.Full 642 * @crossplatform 643 * @atomicservice 644 * @since 12 645 */ 646 textShadow(value: ShadowOptions | Array<ShadowOptions>): TextTimerAttribute; 647 648 /** 649 * Set the content modifier of texttimer. 650 * 651 * @param { ContentModifier<TextTimerConfiguration> } modifier - The content modifier of texttimer. 652 * @returns { TextTimerAttribute } 653 * @syscap SystemCapability.ArkUI.ArkUI.Full 654 * @crossplatform 655 * @atomicservice 656 * @since 12 657 */ 658 contentModifier(modifier: ContentModifier<TextTimerConfiguration>): TextTimerAttribute; 659} 660 661/** 662 * Defines TextTimer Component. 663 * 664 * @syscap SystemCapability.ArkUI.ArkUI.Full 665 * @since 8 666 */ 667/** 668 * Defines TextTimer Component. 669 * 670 * @syscap SystemCapability.ArkUI.ArkUI.Full 671 * @crossplatform 672 * @form 673 * @since 10 674 */ 675/** 676 * Defines TextTimer Component. 677 * 678 * @syscap SystemCapability.ArkUI.ArkUI.Full 679 * @crossplatform 680 * @form 681 * @atomicservice 682 * @since 11 683 */ 684declare const TextTimer: TextTimerInterface; 685 686/** 687 * Defines TextTimer Component instance. 688 * 689 * @syscap SystemCapability.ArkUI.ArkUI.Full 690 * @since 8 691 */ 692/** 693 * Defines TextTimer Component instance. 694 * 695 * @syscap SystemCapability.ArkUI.ArkUI.Full 696 * @crossplatform 697 * @form 698 * @since 10 699 */ 700/** 701 * Defines TextTimer Component instance. 702 * 703 * @syscap SystemCapability.ArkUI.ArkUI.Full 704 * @crossplatform 705 * @form 706 * @atomicservice 707 * @since 11 708 */ 709declare const TextTimerInstance: TextTimerAttribute; 710