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