@oscarpalmer/timer 0.36.0 → 0.38.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +13 -13
- package/dist/constants.js +11 -13
- package/dist/delay.js +3 -3
- package/dist/get.js +2 -2
- package/dist/global.js +5 -4
- package/dist/index.js +4 -4
- package/dist/is.js +1 -1
- package/dist/repeat.js +2 -2
- package/dist/toretto.full.js +515 -0
- package/dist/wait.js +2 -2
- package/dist/when.js +11 -8
- package/dist/work.js +11 -11
- package/package.json +36 -61
- package/src/constants.ts +20 -14
- package/src/delay.ts +6 -7
- package/src/get.ts +4 -6
- package/src/global.ts +5 -9
- package/src/is.ts +9 -1
- package/src/models.ts +35 -40
- package/src/repeat.ts +6 -6
- package/src/timer.ts +4 -17
- package/src/wait.ts +2 -2
- package/src/when.ts +35 -31
- package/src/work.ts +17 -32
- package/types/constants.d.ts +12 -12
- package/types/delay.d.ts +3 -1
- package/types/get.d.ts +1 -1
- package/types/is.d.ts +8 -0
- package/types/repeat.d.ts +3 -0
- package/types/when.d.ts +15 -1
- package/dist/constants.cjs +0 -53
- package/dist/delay.cjs +0 -15
- package/dist/get.cjs +0 -16
- package/dist/global.cjs +0 -14
- package/dist/index.cjs +0 -14
- package/dist/is.cjs +0 -20
- package/dist/models.cjs +0 -7
- package/dist/repeat.cjs +0 -18
- package/dist/rolldown_runtime.cjs +0 -21
- package/dist/timer.cjs +0 -67
- package/dist/timer.full.js +0 -530
- package/dist/wait.cjs +0 -18
- package/dist/when.cjs +0 -95
- package/dist/work.cjs +0 -82
- package/types/constants.d.cts +0 -104
- package/types/delay.d.cts +0 -8
- package/types/get.d.cts +0 -11
- package/types/global.d.cts +0 -3
- package/types/index.d.cts +0 -187
- package/types/is.d.cts +0 -144
- package/types/models.d.cts +0 -128
- package/types/repeat.d.cts +0 -99
- package/types/timer.d.cts +0 -70
- package/types/wait.d.cts +0 -76
- package/types/when.d.cts +0 -66
- package/types/work.d.cts +0 -81
package/types/repeat.d.cts
DELETED
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
// Generated by dts-bundle-generator v9.5.1
|
|
2
|
-
|
|
3
|
-
export declare class Timer {
|
|
4
|
-
#private;
|
|
5
|
-
protected readonly options: TimerOptions;
|
|
6
|
-
private readonly $timer;
|
|
7
|
-
protected readonly state: TimerState;
|
|
8
|
-
/**
|
|
9
|
-
* Is the timer active?
|
|
10
|
-
*/
|
|
11
|
-
get active(): boolean;
|
|
12
|
-
/**
|
|
13
|
-
* Is the timer destroyed?
|
|
14
|
-
*/
|
|
15
|
-
get destroyed(): boolean;
|
|
16
|
-
/**
|
|
17
|
-
* Is the timer paused?
|
|
18
|
-
*/
|
|
19
|
-
get paused(): boolean;
|
|
20
|
-
/**
|
|
21
|
-
* Get the timer's origin _(if debugging is enabled)_
|
|
22
|
-
*/
|
|
23
|
-
get trace(): string | undefined;
|
|
24
|
-
constructor(type: TimerType, state: Pick<TimerState, "callback" | "trace">, options: TimerOptions, start: boolean);
|
|
25
|
-
/**
|
|
26
|
-
* Continue running the timer _(if it's paused)_
|
|
27
|
-
*/
|
|
28
|
-
continue(): Timer;
|
|
29
|
-
/**
|
|
30
|
-
* Destroy the timer
|
|
31
|
-
*/
|
|
32
|
-
destroy(): void;
|
|
33
|
-
/**
|
|
34
|
-
* Pause the timer _(if it's running)_
|
|
35
|
-
*/
|
|
36
|
-
pause(): Timer;
|
|
37
|
-
/**
|
|
38
|
-
* Restart the timer _(or start it, if it's not running)_
|
|
39
|
-
*/
|
|
40
|
-
restart(): Timer;
|
|
41
|
-
/**
|
|
42
|
-
* Start the timer _(if it's not running)_
|
|
43
|
-
*/
|
|
44
|
-
start(): Timer;
|
|
45
|
-
/**
|
|
46
|
-
* Stop the timer _(if it's running)_
|
|
47
|
-
*/
|
|
48
|
-
stop(): Timer;
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
* Options for a repeating timer
|
|
52
|
-
*/
|
|
53
|
-
export type RepeatOptions = {
|
|
54
|
-
/**
|
|
55
|
-
* Callback to be called when the timer has stopped, either manually or by completing its work
|
|
56
|
-
*/
|
|
57
|
-
onAfter: (finished: boolean) => void;
|
|
58
|
-
/**
|
|
59
|
-
* Callback to be called after the timer has timed out
|
|
60
|
-
*/
|
|
61
|
-
onTimeout: () => void;
|
|
62
|
-
/**
|
|
63
|
-
* How many times the timer should repeat
|
|
64
|
-
*/
|
|
65
|
-
count: number;
|
|
66
|
-
/**
|
|
67
|
-
* The interval between each repeat
|
|
68
|
-
*/
|
|
69
|
-
interval: number;
|
|
70
|
-
/**
|
|
71
|
-
* The timeout for the timer _(any value above `0` will enable the timeout)_
|
|
72
|
-
*/
|
|
73
|
-
timeout: number;
|
|
74
|
-
};
|
|
75
|
-
export type TimerOptions = {
|
|
76
|
-
onAfter: ((finished: boolean) => void) | undefined;
|
|
77
|
-
onError: (() => void) | undefined;
|
|
78
|
-
count: number;
|
|
79
|
-
interval: number;
|
|
80
|
-
timeout: number;
|
|
81
|
-
};
|
|
82
|
-
export type TimerState = {
|
|
83
|
-
active: boolean;
|
|
84
|
-
callback: () => void;
|
|
85
|
-
destroyed: boolean;
|
|
86
|
-
elapsed: number;
|
|
87
|
-
frame: number | undefined;
|
|
88
|
-
index: number;
|
|
89
|
-
paused: boolean;
|
|
90
|
-
total: number;
|
|
91
|
-
trace: string | undefined;
|
|
92
|
-
};
|
|
93
|
-
export type TimerType = "repeat" | "wait" | "when";
|
|
94
|
-
/**
|
|
95
|
-
* Create a repeating timer
|
|
96
|
-
*/
|
|
97
|
-
export declare function repeat(callback: (index: number) => void, options?: Partial<RepeatOptions>): Timer;
|
|
98
|
-
|
|
99
|
-
export {};
|
package/types/timer.d.cts
DELETED
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
// Generated by dts-bundle-generator v9.5.1
|
|
2
|
-
|
|
3
|
-
export declare class Timer {
|
|
4
|
-
#private;
|
|
5
|
-
protected readonly options: TimerOptions;
|
|
6
|
-
private readonly $timer;
|
|
7
|
-
protected readonly state: TimerState;
|
|
8
|
-
/**
|
|
9
|
-
* Is the timer active?
|
|
10
|
-
*/
|
|
11
|
-
get active(): boolean;
|
|
12
|
-
/**
|
|
13
|
-
* Is the timer destroyed?
|
|
14
|
-
*/
|
|
15
|
-
get destroyed(): boolean;
|
|
16
|
-
/**
|
|
17
|
-
* Is the timer paused?
|
|
18
|
-
*/
|
|
19
|
-
get paused(): boolean;
|
|
20
|
-
/**
|
|
21
|
-
* Get the timer's origin _(if debugging is enabled)_
|
|
22
|
-
*/
|
|
23
|
-
get trace(): string | undefined;
|
|
24
|
-
constructor(type: TimerType, state: Pick<TimerState, "callback" | "trace">, options: TimerOptions, start: boolean);
|
|
25
|
-
/**
|
|
26
|
-
* Continue running the timer _(if it's paused)_
|
|
27
|
-
*/
|
|
28
|
-
continue(): Timer;
|
|
29
|
-
/**
|
|
30
|
-
* Destroy the timer
|
|
31
|
-
*/
|
|
32
|
-
destroy(): void;
|
|
33
|
-
/**
|
|
34
|
-
* Pause the timer _(if it's running)_
|
|
35
|
-
*/
|
|
36
|
-
pause(): Timer;
|
|
37
|
-
/**
|
|
38
|
-
* Restart the timer _(or start it, if it's not running)_
|
|
39
|
-
*/
|
|
40
|
-
restart(): Timer;
|
|
41
|
-
/**
|
|
42
|
-
* Start the timer _(if it's not running)_
|
|
43
|
-
*/
|
|
44
|
-
start(): Timer;
|
|
45
|
-
/**
|
|
46
|
-
* Stop the timer _(if it's running)_
|
|
47
|
-
*/
|
|
48
|
-
stop(): Timer;
|
|
49
|
-
}
|
|
50
|
-
export type TimerOptions = {
|
|
51
|
-
onAfter: ((finished: boolean) => void) | undefined;
|
|
52
|
-
onError: (() => void) | undefined;
|
|
53
|
-
count: number;
|
|
54
|
-
interval: number;
|
|
55
|
-
timeout: number;
|
|
56
|
-
};
|
|
57
|
-
export type TimerState = {
|
|
58
|
-
active: boolean;
|
|
59
|
-
callback: () => void;
|
|
60
|
-
destroyed: boolean;
|
|
61
|
-
elapsed: number;
|
|
62
|
-
frame: number | undefined;
|
|
63
|
-
index: number;
|
|
64
|
-
paused: boolean;
|
|
65
|
-
total: number;
|
|
66
|
-
trace: string | undefined;
|
|
67
|
-
};
|
|
68
|
-
export type TimerType = "repeat" | "wait" | "when";
|
|
69
|
-
|
|
70
|
-
export {};
|
package/types/wait.d.cts
DELETED
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
// Generated by dts-bundle-generator v9.5.1
|
|
2
|
-
|
|
3
|
-
export declare class Timer {
|
|
4
|
-
#private;
|
|
5
|
-
protected readonly options: TimerOptions;
|
|
6
|
-
private readonly $timer;
|
|
7
|
-
protected readonly state: TimerState;
|
|
8
|
-
/**
|
|
9
|
-
* Is the timer active?
|
|
10
|
-
*/
|
|
11
|
-
get active(): boolean;
|
|
12
|
-
/**
|
|
13
|
-
* Is the timer destroyed?
|
|
14
|
-
*/
|
|
15
|
-
get destroyed(): boolean;
|
|
16
|
-
/**
|
|
17
|
-
* Is the timer paused?
|
|
18
|
-
*/
|
|
19
|
-
get paused(): boolean;
|
|
20
|
-
/**
|
|
21
|
-
* Get the timer's origin _(if debugging is enabled)_
|
|
22
|
-
*/
|
|
23
|
-
get trace(): string | undefined;
|
|
24
|
-
constructor(type: TimerType, state: Pick<TimerState, "callback" | "trace">, options: TimerOptions, start: boolean);
|
|
25
|
-
/**
|
|
26
|
-
* Continue running the timer _(if it's paused)_
|
|
27
|
-
*/
|
|
28
|
-
continue(): Timer;
|
|
29
|
-
/**
|
|
30
|
-
* Destroy the timer
|
|
31
|
-
*/
|
|
32
|
-
destroy(): void;
|
|
33
|
-
/**
|
|
34
|
-
* Pause the timer _(if it's running)_
|
|
35
|
-
*/
|
|
36
|
-
pause(): Timer;
|
|
37
|
-
/**
|
|
38
|
-
* Restart the timer _(or start it, if it's not running)_
|
|
39
|
-
*/
|
|
40
|
-
restart(): Timer;
|
|
41
|
-
/**
|
|
42
|
-
* Start the timer _(if it's not running)_
|
|
43
|
-
*/
|
|
44
|
-
start(): Timer;
|
|
45
|
-
/**
|
|
46
|
-
* Stop the timer _(if it's running)_
|
|
47
|
-
*/
|
|
48
|
-
stop(): Timer;
|
|
49
|
-
}
|
|
50
|
-
export type TimerOptions = {
|
|
51
|
-
onAfter: ((finished: boolean) => void) | undefined;
|
|
52
|
-
onError: (() => void) | undefined;
|
|
53
|
-
count: number;
|
|
54
|
-
interval: number;
|
|
55
|
-
timeout: number;
|
|
56
|
-
};
|
|
57
|
-
export type TimerState = {
|
|
58
|
-
active: boolean;
|
|
59
|
-
callback: () => void;
|
|
60
|
-
destroyed: boolean;
|
|
61
|
-
elapsed: number;
|
|
62
|
-
frame: number | undefined;
|
|
63
|
-
index: number;
|
|
64
|
-
paused: boolean;
|
|
65
|
-
total: number;
|
|
66
|
-
trace: string | undefined;
|
|
67
|
-
};
|
|
68
|
-
export type TimerType = "repeat" | "wait" | "when";
|
|
69
|
-
/**
|
|
70
|
-
* Create a waiting timer
|
|
71
|
-
* @param callback Callback to run when the timer has finished
|
|
72
|
-
* @param time How long to wait for _(in milliseconds; defaults to screen refresh rate)_
|
|
73
|
-
*/
|
|
74
|
-
export declare function wait(callback: () => void, time?: number): Timer;
|
|
75
|
-
|
|
76
|
-
export {};
|
package/types/when.d.cts
DELETED
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
// Generated by dts-bundle-generator v9.5.1
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Options for a conditional timer
|
|
5
|
-
*/
|
|
6
|
-
export type WhenOptions = {
|
|
7
|
-
/**
|
|
8
|
-
* How many times the timer should check the condition
|
|
9
|
-
*/
|
|
10
|
-
count: number;
|
|
11
|
-
/**
|
|
12
|
-
* Then interval between each condtional check
|
|
13
|
-
*/
|
|
14
|
-
interval: number;
|
|
15
|
-
/**
|
|
16
|
-
* The timeout for the timer _(any value above `0` will enable the timeout)_
|
|
17
|
-
*/
|
|
18
|
-
timeout: number;
|
|
19
|
-
};
|
|
20
|
-
export declare class When {
|
|
21
|
-
private readonly $timer;
|
|
22
|
-
private readonly state;
|
|
23
|
-
/**
|
|
24
|
-
* Is the timer active?
|
|
25
|
-
*/
|
|
26
|
-
get active(): boolean;
|
|
27
|
-
/**
|
|
28
|
-
* Is the timer destroyed?
|
|
29
|
-
*/
|
|
30
|
-
get destroyed(): boolean;
|
|
31
|
-
/**
|
|
32
|
-
* Is the timer paused?
|
|
33
|
-
*/
|
|
34
|
-
get paused(): boolean;
|
|
35
|
-
/**
|
|
36
|
-
* Get the timer's origin _(if debugging is enabled)_
|
|
37
|
-
*/
|
|
38
|
-
get trace(): string | undefined;
|
|
39
|
-
constructor(condition: () => boolean, options?: Partial<WhenOptions>);
|
|
40
|
-
/**
|
|
41
|
-
* Continues the timer _(if it was paused)_
|
|
42
|
-
*/
|
|
43
|
-
continue(): When;
|
|
44
|
-
/**
|
|
45
|
-
* Destroys the timer _(and stops it,if it was running)_
|
|
46
|
-
*/
|
|
47
|
-
destroy(): void;
|
|
48
|
-
/**
|
|
49
|
-
* Pauses the timer _(if it was running)_
|
|
50
|
-
*/
|
|
51
|
-
pause(): When;
|
|
52
|
-
/**
|
|
53
|
-
* Stops the timer _(if it was running)_
|
|
54
|
-
*/
|
|
55
|
-
stop(): When;
|
|
56
|
-
/**
|
|
57
|
-
* Starts the timer and returns a promise that resolves when the condition is met
|
|
58
|
-
*/
|
|
59
|
-
then(resolve?: (() => void) | null, reject?: (() => void) | null): Promise<void>;
|
|
60
|
-
}
|
|
61
|
-
/**
|
|
62
|
-
* Create a conditional timer
|
|
63
|
-
*/
|
|
64
|
-
export declare function when(condition: () => boolean, options?: Partial<WhenOptions>): When;
|
|
65
|
-
|
|
66
|
-
export {};
|
package/types/work.d.cts
DELETED
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
// Generated by dts-bundle-generator v9.5.1
|
|
2
|
-
|
|
3
|
-
declare class Timer {
|
|
4
|
-
#private;
|
|
5
|
-
protected readonly options: TimerOptions;
|
|
6
|
-
private readonly $timer;
|
|
7
|
-
protected readonly state: TimerState;
|
|
8
|
-
/**
|
|
9
|
-
* Is the timer active?
|
|
10
|
-
*/
|
|
11
|
-
get active(): boolean;
|
|
12
|
-
/**
|
|
13
|
-
* Is the timer destroyed?
|
|
14
|
-
*/
|
|
15
|
-
get destroyed(): boolean;
|
|
16
|
-
/**
|
|
17
|
-
* Is the timer paused?
|
|
18
|
-
*/
|
|
19
|
-
get paused(): boolean;
|
|
20
|
-
/**
|
|
21
|
-
* Get the timer's origin _(if debugging is enabled)_
|
|
22
|
-
*/
|
|
23
|
-
get trace(): string | undefined;
|
|
24
|
-
constructor(type: TimerType, state: Pick<TimerState, "callback" | "trace">, options: TimerOptions, start: boolean);
|
|
25
|
-
/**
|
|
26
|
-
* Continue running the timer _(if it's paused)_
|
|
27
|
-
*/
|
|
28
|
-
continue(): Timer;
|
|
29
|
-
/**
|
|
30
|
-
* Destroy the timer
|
|
31
|
-
*/
|
|
32
|
-
destroy(): void;
|
|
33
|
-
/**
|
|
34
|
-
* Pause the timer _(if it's running)_
|
|
35
|
-
*/
|
|
36
|
-
pause(): Timer;
|
|
37
|
-
/**
|
|
38
|
-
* Restart the timer _(or start it, if it's not running)_
|
|
39
|
-
*/
|
|
40
|
-
restart(): Timer;
|
|
41
|
-
/**
|
|
42
|
-
* Start the timer _(if it's not running)_
|
|
43
|
-
*/
|
|
44
|
-
start(): Timer;
|
|
45
|
-
/**
|
|
46
|
-
* Stop the timer _(if it's running)_
|
|
47
|
-
*/
|
|
48
|
-
stop(): Timer;
|
|
49
|
-
}
|
|
50
|
-
export type TimerOptions = {
|
|
51
|
-
onAfter: ((finished: boolean) => void) | undefined;
|
|
52
|
-
onError: (() => void) | undefined;
|
|
53
|
-
count: number;
|
|
54
|
-
interval: number;
|
|
55
|
-
timeout: number;
|
|
56
|
-
};
|
|
57
|
-
export type TimerState = {
|
|
58
|
-
active: boolean;
|
|
59
|
-
callback: () => void;
|
|
60
|
-
destroyed: boolean;
|
|
61
|
-
elapsed: number;
|
|
62
|
-
frame: number | undefined;
|
|
63
|
-
index: number;
|
|
64
|
-
paused: boolean;
|
|
65
|
-
total: number;
|
|
66
|
-
trace: string | undefined;
|
|
67
|
-
};
|
|
68
|
-
export type TimerType = "repeat" | "wait" | "when";
|
|
69
|
-
export type WorkHandlerTimer = {
|
|
70
|
-
instance: Timer;
|
|
71
|
-
type: TimerType;
|
|
72
|
-
};
|
|
73
|
-
export type WorkHandlerType = "continue" | "pause" | "restart" | "start" | "stop";
|
|
74
|
-
declare function stop$1(timer: WorkHandlerTimer, state: TimerState, options: TimerOptions): Timer;
|
|
75
|
-
export declare function work(type: WorkHandlerType, timer: WorkHandlerTimer, state: TimerState, options: TimerOptions): Timer;
|
|
76
|
-
|
|
77
|
-
export {
|
|
78
|
-
stop$1 as stop,
|
|
79
|
-
};
|
|
80
|
-
|
|
81
|
-
export {};
|