-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.d.ts
65 lines (61 loc) · 2.7 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
/**
* Time,倒计时时间
*/
type CountDownTime = number | null | undefined;
/**
* Initial Options, 倒计时初始化参数
*/
interface CountDownOptions {
// 倒计时步进间隔,默认: 1000
interval?: number;
// 是否自动开启,默认为: true
autoStart?: boolean;
// 倒计时类型,d: 到天,h: 到小时,m: 到分钟,s: 到秒,S: 到毫秒,默认:'h'.
cdType?: 'd' | 'h' | 'm' | 's' | 'S';
}
/**
* CountDown 构造定义
*/
declare class CountDown {
time: number | null; // 倒计时时间
options: CountDownOptions; // 初始化的参数
initTime: number | null; // 初始化的时间
restTime: number; // 剩余时间
interval: number; // 定时间隔
autoStart: boolean; // 是否自动启动
cdType: 'd' | 'h' | 'm' | 's'; // 倒计时类型
running: boolean; // 是否运行中
destoryed: boolean; // 是否已销毁
completed: boolean; // 是否已结束
tickTimes: number; // 步进次数
restDays: number | null; // 剩余天数
restHours: number | null; // 剩余小时
restMinuts: number | null; // 剩余分钟
restSeconds: number | null; // 剩余秒数
restMilliSeconds: number | null; // 剩余毫秒数
d: number | null; // 天数
h: number | null; // 小时
m: number | null; // 分钟
s: number | null; // 秒数
S: number | null; // 毫秒数
dd: string; // 至少两位天数,'--'
hh: string; // 至少两位小时,'--'
mm: string; // 至少两位分钟,'--'
ss: string; // 至少两位秒数,'--'
SSS: string; // 至少三位毫秒数,'---'
ms: string; // 分秒,'-:-'
hms: string; // 时分秒,'-:-:-'
mmss: string; // 分钟秒数:'--:--'
hhmmss: string; // 小时分钟秒数:'--:--:--'
timerId: any; // 定时器ID
start: () => void; // 开启倒计时
stop: () => void; // 停止倒计时
destory: () => void; // 销毁倒计时
onTick?: (cd: CountDown) => any; // 自定义步进处理函数
[prop: string]: any; // 其它属性
constructor(tickHandler?: (cd: CountDown) => any);
constructor(time: CountDownTime, tickHandler?: (cd: CountDown) => any);
constructor(time: CountDownTime, options: CountDownOptions, tickHandler?: (cd: CountDown) => any);
}
export = CountDown;
export as namespace CountDown;