@oscarpalmer/timer 0.35.0 → 0.37.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/dist/delay.cjs +1 -1
- package/dist/delay.js +1 -1
- package/dist/get.cjs +9 -2
- package/dist/get.js +7 -2
- package/dist/global.cjs +1 -0
- package/dist/global.js +1 -0
- package/dist/is.cjs +1 -1
- package/dist/is.js +1 -1
- package/dist/repeat.cjs +2 -2
- package/dist/repeat.js +2 -2
- package/dist/timer.cjs +2 -1
- package/dist/timer.full.js +13 -9
- package/dist/when.cjs +3 -2
- package/dist/when.js +3 -3
- package/dist/work.cjs +7 -7
- package/dist/work.js +7 -7
- package/package.json +32 -54
- package/src/get.ts +11 -6
- package/src/global.ts +1 -0
- package/src/is.ts +1 -1
- package/src/models.ts +34 -26
- package/src/repeat.ts +2 -2
- package/src/when.ts +2 -3
- package/types/get.d.ts +2 -1
- package/types/models.d.ts +10 -2
- package/types/constants.d.cts +0 -104
- package/types/delay.d.cts +0 -8
- package/types/get.d.cts +0 -10
- package/types/global.d.cts +0 -3
- package/types/index.d.cts +0 -179
- package/types/is.d.cts +0 -144
- package/types/models.d.cts +0 -120
- package/types/repeat.d.cts +0 -91
- 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/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
|
|
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 {};
|