This repository was archived by the owner on Dec 9, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathTimer.d.ts
122 lines (122 loc) · 3.74 KB
/
Timer.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
import EventDispatcher from '../event/EventDispatcher';
/**
* Constructs a new Timer object with the specified delay and repeatCount states.
*
* @class Timer
* @extends EventDispatcher
* @module StructureJS
* @submodule util
* @requires Extend
* @requires EventDispatcher
* @requires TimerEvent
* @constructor
* @author Robert S. (www.codeBelt.com)
*/
declare class Timer extends EventDispatcher {
/**
* A reference to the setInterval object.
*
* @property _timer
* @type {Function}
* @protected
*/
protected _timer: any;
/**
* The total number of times the timer has fired since it started at zero. If the timer has been reset, only the fires since the reset are counted.
*
* @property currentCount
* @type {int}
* @protected
*/
protected _currentCount: number;
/**
* The delay, in milliseconds, between timer events. If you set the delay interval while the timer is running, the timer will restart at the same repeatCount iteration.
* <strong>Note:</strong> A delay lower than 20 milliseconds is not recommended.
*
* @property delay
* @type {number}
* @protected
*/
protected _delay: number;
/**
* The total number of times the timer is set to run. If the repeat count is set to 0, the timer continues indefinitely. If the repeat count is nonzero, the timer runs the specified number of times. If repeatCount is set to a total that is the same or less then currentCount the timer stops and will not fire again.
*
* @property repeatCount
* @type {int}
* @protected
*/
protected _repeatCount: number;
/**
* The timer's current state; true if the timer is running, otherwise false.
*
* @property running
* @type {boolean}
* @readOnly
*/
running: boolean;
constructor(delay: number, repeatCount?: number);
/**
* Returns the total number of times the timer has fired since it started at zero.
*
* @method getCurrentCount
* @returns {number} The total number of times the timer has fired since it started at zero.
*/
getCurrentCount(): number;
/**
* Returns the delay time in milliseconds.
*
* @method getDelay
* @returns {number} Returns the delay time in milliseconds.
*/
getDelay(): number;
/**
* Sets the delay, in milliseconds, between timer events.
*
* @method setDelay
* @param value {number}
*/
setDelay(value: number): any;
/**
* Returns the total number of times the timer is set to run.
*
* @method getRepeatCount
* @returns {number} Returns the total number of times the timer is set to run.
*/
getRepeatCount(): number;
/**
* Set the total number of times the timer is set to run. If the repeat count is set to 0, the timer continues indefinitely. If the repeat count is nonzero, the timer runs the specified number of times. If repeatCount is set to a total that is the same or less then currentCount the timer stops and will not fire again.
*
* @method setRepeatCount
* @param value {number}
*/
setRepeatCount(value: number): any;
/**
* Stops the timer, if it is running, and sets the currentCount property back to 0, like the reset button of a stopwatch.
*
* @method reset
*/
reset(): any;
/**
* Starts the timer, if it is not already running.
*
* @method start
*/
start(): any;
/**
* Stops the timer.
*
* @method stop
*/
stop(): any;
/**
*
* @method _decrementCounter
* @protected
*/
protected _decrementCounter(): void;
/**
* @overridden EventDispatcher.destroy
*/
destroy(): void;
}
export default Timer;