• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2021 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 * @since 8
19 */
20declare class TextTimerController {
21  /**
22   * constructor.
23   * @since 8
24   */
25  constructor();
26
27  /**
28   * Provides a start event for timer.
29   * @since 8
30   */
31  start();
32
33  /**
34   * Provides a pause event for timer.
35   * @since 8
36   */
37  pause();
38
39  /**
40   * Provides an event to reset timer.
41   * @since 8
42   */
43  reset();
44}
45
46/**
47 * Defines the options of TextTimer.
48 * @since 8
49 */
50interface TextTimerOptions {
51  /**
52   * Sets whether to countdown.The default value is false.
53   * @since 8
54   */
55  isCountDown?: boolean;
56  /**
57   * Specifies the timer range.
58   * In the non-countDown scenario, a negative value indicates that the timer is not limited.
59   * The unit is millisecond.
60   * @since 8
61   */
62  count?: number;
63
64  /**
65   * Controller of Texttimer.
66   * @since 8
67   */
68  controller?: TextTimerController;
69}
70
71/**
72 * Provides an interface for texttimer containers.
73 * @since 8
74 */
75interface TextTimerInterface {
76  /**
77   * Defines the TextTimer constructor.
78   * @since 8
79   */
80  (options?: TextTimerOptions): TextTimerAttribute;
81}
82
83/**
84 * Defines the TextTimer attribute functions.
85 * @since 8
86 */
87declare class TextTimerAttribute extends CommonMethod<TextTimerAttribute> {
88  /**
89   * Set the display time format, for example, now is hh/mm/ss/ms and current: hh-mm-ss-ms.
90   * The time format string can be hh, mm, ss, or ms.
91   * @since 8
92   */
93  format(value: string): TextTimerAttribute;
94  /**
95   * Called when the font color is set.
96   * @since 8
97   */
98  fontColor(value: ResourceColor): TextTimerAttribute;
99  /**
100   * Called when the font size is set.
101   * @since 8
102   */
103  fontSize(value: Length): TextTimerAttribute;
104  /**
105   * Called when the fontStyle is set
106   * @since 8
107   */
108  fontStyle(value: FontStyle): TextTimerAttribute;
109  /**
110   * Called when the fontWeight is set
111   * @since 8
112   */
113  fontWeight(value: number | FontWeight | string): TextTimerAttribute;
114  /**
115   * Called when the fontFamily is set
116   * @since 8
117   */
118  fontFamily(value: ResourceStr): TextTimerAttribute;
119  /**
120   * Called when the timer value is returned.
121   * @since 8
122   */
123  onTimer(event: (utc: number, elapsedTime: number) => void): TextTimerAttribute;
124}
125
126/**
127 * Defines TextTimer Component.
128 * @since 8
129 */
130declare const TextTimer: TextTimerInterface;
131
132/**
133 * Defines TextTimer Component instance.
134 * @since 8
135 */
136declare const TextTimerInstance: TextTimerAttribute;
137