• 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 * Provides a way to control the process.
18 *
19 * @since 8
20 */
21/**
22 * Provides a way to control the process.
23 *
24 * @syscap SystemCapability.ArkUI.ArkUI.Full
25 * @crossplatform
26 * @since 10
27 * @form
28 */
29declare class TextTimerController {
30  /**
31   * constructor.
32   *
33   * @syscap SystemCapability.ArkUI.ArkUI.Full
34   * @since 8
35   */
36  /**
37   * constructor.
38   *
39   * @syscap SystemCapability.ArkUI.ArkUI.Full
40   * @crossplatform
41   * @since 10
42   * @form
43   */
44  constructor();
45
46  /**
47   * Provides a start event for timer.
48   *
49   * @syscap SystemCapability.ArkUI.ArkUI.Full
50   * @since 8
51   */
52  /**
53   * Provides a start event for timer.
54   *
55   * @syscap SystemCapability.ArkUI.ArkUI.Full
56   * @crossplatform
57   * @since 10
58   * @form
59   */
60  start();
61
62  /**
63   * Provides a pause event for timer.
64   *
65   * @syscap SystemCapability.ArkUI.ArkUI.Full
66   * @since 8
67   */
68  /**
69   * Provides a pause event for timer.
70   *
71   * @syscap SystemCapability.ArkUI.ArkUI.Full
72   * @crossplatform
73   * @since 10
74   * @form
75   */
76  pause();
77
78  /**
79   * Provides an event to reset timer.
80   *
81   * @syscap SystemCapability.ArkUI.ArkUI.Full
82   * @since 8
83   */
84  /**
85   * Provides an event to reset timer.
86   *
87   * @syscap SystemCapability.ArkUI.ArkUI.Full
88   * @crossplatform
89   * @since 10
90   * @form
91   */
92  reset();
93}
94
95/**
96 * Defines the options of TextTimer.
97 *
98 * @interface TextTimerOptions
99 * @syscap SystemCapability.ArkUI.ArkUI.Full
100 * @since 8
101 */
102/**
103 * Defines the options of TextTimer.
104 *
105 * @interface TextTimerOptions
106 * @syscap SystemCapability.ArkUI.ArkUI.Full
107 * @crossplatform
108 * @since 10
109 * @form
110 */
111interface TextTimerOptions {
112  /**
113   * Sets whether to countdown.The default value is false.
114   *
115   * @type { ?boolean }
116   * @syscap SystemCapability.ArkUI.ArkUI.Full
117   * @since 8
118   */
119  /**
120   * Sets whether to countdown.The default value is false.
121   *
122   * @type { ?boolean }
123   * @syscap SystemCapability.ArkUI.ArkUI.Full
124   * @crossplatform
125   * @since 10
126   * @form
127   */
128  isCountDown?: boolean;
129
130  /**
131   * Specifies the timer range.
132   * In the non-countDown scenario, a negative value indicates that the timer is not limited.
133   * The unit is millisecond.
134   *
135   * @type { ?number }
136   * @syscap SystemCapability.ArkUI.ArkUI.Full
137   * @since 8
138   */
139  /**
140   * Specifies the timer range.
141   * In the non-countDown scenario, a negative value indicates that the timer is not limited.
142   * The unit is millisecond.
143   *
144   * @type { ?number }
145   * @syscap SystemCapability.ArkUI.ArkUI.Full
146   * @crossplatform
147   * @since 10
148   * @form
149   */
150  count?: number;
151
152  /**
153   * Controller of Texttimer.
154   *
155   * @type { ?TextTimerController }
156   * @syscap SystemCapability.ArkUI.ArkUI.Full
157   * @since 8
158   */
159  /**
160   * Controller of Texttimer.
161   *
162   * @type { ?TextTimerController }
163   * @syscap SystemCapability.ArkUI.ArkUI.Full
164   * @crossplatform
165   * @since 10
166   * @form
167   */
168  controller?: TextTimerController;
169}
170
171/**
172 * Provides an interface for texttimer containers.
173 *
174 * @interface TextTimerInterface
175 * @syscap SystemCapability.ArkUI.ArkUI.Full
176 * @since 8
177 */
178/**
179 * Provides an interface for texttimer containers.
180 *
181 * @interface TextTimerInterface
182 * @syscap SystemCapability.ArkUI.ArkUI.Full
183 * @crossplatform
184 * @since 10
185 * @form
186 */
187interface TextTimerInterface {
188  /**
189   * Defines the TextTimer constructor.
190   *
191   * @param { TextTimerOptions } options
192   * @returns { TextTimerAttribute }
193   * @syscap SystemCapability.ArkUI.ArkUI.Full
194   * @since 8
195   */
196  /**
197   * Defines the TextTimer constructor.
198   *
199   * @param { TextTimerOptions } options
200   * @returns { TextTimerAttribute }
201   * @syscap SystemCapability.ArkUI.ArkUI.Full
202   * @crossplatform
203   * @since 10
204   * @form
205   */
206  (options?: TextTimerOptions): TextTimerAttribute;
207}
208
209/**
210 * Defines the TextTimer attribute functions.
211 *
212 * @extends CommonMethod
213 * @since 8
214 */
215/**
216 * Defines the TextTimer attribute functions.
217 *
218 * @extends CommonMethod
219 * @syscap SystemCapability.ArkUI.ArkUI.Full
220 * @crossplatform
221 * @since 10
222 * @form
223 */
224declare class TextTimerAttribute extends CommonMethod<TextTimerAttribute> {
225  /**
226   * Set the display time format, for example, now is hh/mm/ss/ms and current: hh-mm-ss-ms.
227   * The time format string can be hh, mm, ss, or ms.
228   *
229   * @param { string } value
230   * @returns { TextTimerAttribute }
231   * @syscap SystemCapability.ArkUI.ArkUI.Full
232   * @since 8
233   */
234  /**
235   * Set the display time format, for example, now is hh/mm/ss/ms and current: hh-mm-ss-ms.
236   * The time format string can be hh, mm, ss, or ms.
237   *
238   * @param { string } value
239   * @returns { TextTimerAttribute }
240   * @syscap SystemCapability.ArkUI.ArkUI.Full
241   * @crossplatform
242   * @since 10
243   * @form
244   */
245  format(value: string): TextTimerAttribute;
246
247  /**
248   * Called when the font color is set.
249   *
250   * @param { ResourceColor } value
251   * @returns { TextTimerAttribute }
252   * @syscap SystemCapability.ArkUI.ArkUI.Full
253   * @since 8
254   */
255  /**
256   * Called when the font color is set.
257   *
258   * @param { ResourceColor } value
259   * @returns { TextTimerAttribute }
260   * @syscap SystemCapability.ArkUI.ArkUI.Full
261   * @crossplatform
262   * @since 10
263   * @form
264   */
265  fontColor(value: ResourceColor): TextTimerAttribute;
266
267  /**
268   * Called when the font size is set.
269   *
270   * @param { Length } value
271   * @returns { TextTimerAttribute }
272   * @syscap SystemCapability.ArkUI.ArkUI.Full
273   * @since 8
274   */
275  /**
276   * Called when the font size is set.
277   *
278   * @param { Length } value
279   * @returns { TextTimerAttribute }
280   * @syscap SystemCapability.ArkUI.ArkUI.Full
281   * @crossplatform
282   * @since 10
283   * @form
284   */
285  fontSize(value: Length): TextTimerAttribute;
286
287  /**
288   * Called when the fontStyle is set
289   *
290   * @param { FontStyle } value
291   * @returns { TextTimerAttribute }
292   * @syscap SystemCapability.ArkUI.ArkUI.Full
293   * @since 8
294   */
295  /**
296   * Called when the fontStyle is set
297   *
298   * @param { FontStyle } value
299   * @returns { TextTimerAttribute }
300   * @syscap SystemCapability.ArkUI.ArkUI.Full
301   * @crossplatform
302   * @since 10
303   * @form
304   */
305  fontStyle(value: FontStyle): TextTimerAttribute;
306
307  /**
308   * Called when the fontWeight is set
309   *
310   * @param { number | FontWeight | string } value
311   * @returns { TextTimerAttribute }
312   * @syscap SystemCapability.ArkUI.ArkUI.Full
313   * @since 8
314   */
315  /**
316   * Called when the fontWeight is set
317   *
318   * @param { number | FontWeight | string } value
319   * @returns { TextTimerAttribute }
320   * @syscap SystemCapability.ArkUI.ArkUI.Full
321   * @crossplatform
322   * @since 10
323   * @form
324   */
325  fontWeight(value: number | FontWeight | string): TextTimerAttribute;
326
327  /**
328   * Called when the fontFamily is set
329   *
330   * @param { ResourceStr } value
331   * @returns { TextTimerAttribute }
332   * @syscap SystemCapability.ArkUI.ArkUI.Full
333   * @since 8
334   */
335  /**
336   * Called when the fontFamily is set
337   *
338   * @param { ResourceStr } value
339   * @returns { TextTimerAttribute }
340   * @syscap SystemCapability.ArkUI.ArkUI.Full
341   * @crossplatform
342   * @since 10
343   * @form
344   */
345  fontFamily(value: ResourceStr): TextTimerAttribute;
346
347  /**
348   * Called when the timer value is returned.
349   *
350   * @param { function } event
351   * @returns { TextTimerAttribute }
352   * @syscap SystemCapability.ArkUI.ArkUI.Full
353   * @since 8
354   */
355  /**
356   * Called when the timer value is returned.
357   *
358   * @param { function } event
359   * @returns { TextTimerAttribute }
360   * @syscap SystemCapability.ArkUI.ArkUI.Full
361   * @crossplatform
362   * @since 10
363   * @form
364   */
365  onTimer(event: (utc: number, elapsedTime: number) => void): TextTimerAttribute;
366}
367
368/**
369 * Defines TextTimer Component.
370 *
371 * @syscap SystemCapability.ArkUI.ArkUI.Full
372 * @since 8
373 */
374/**
375 * Defines TextTimer Component.
376 *
377 * @syscap SystemCapability.ArkUI.ArkUI.Full
378 * @crossplatform
379 * @since 10
380 * @form
381 */
382declare const TextTimer: TextTimerInterface;
383
384/**
385 * Defines TextTimer Component instance.
386 *
387 * @syscap SystemCapability.ArkUI.ArkUI.Full
388 * @since 8
389 */
390/**
391 * Defines TextTimer Component instance.
392 *
393 * @syscap SystemCapability.ArkUI.ArkUI.Full
394 * @crossplatform
395 * @since 10
396 * @form
397 */
398declare const TextTimerInstance: TextTimerAttribute;
399