@byloth/core 2.1.3 → 2.1.5
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/core.cjs +2 -2
- package/dist/core.cjs.map +1 -1
- package/dist/core.esm.js +333 -249
- package/dist/core.esm.js.map +1 -1
- package/dist/core.global.js +2 -2
- package/dist/core.global.js.map +1 -1
- package/dist/core.umd.cjs +2 -2
- package/dist/core.umd.cjs.map +1 -1
- package/package.json +6 -6
- package/src/core/types.ts +1 -1
- package/src/index.ts +2 -1
- package/src/models/aggregators/aggregated-async-iterator.ts +1 -1
- package/src/models/aggregators/aggregated-iterator.ts +1 -1
- package/src/models/aggregators/reduced-iterator.ts +1 -1
- package/src/models/callbacks/publisher.ts +80 -9
- package/src/models/callbacks/switchable-callback.ts +1 -1
- package/src/models/callbacks/types.ts +13 -0
- package/src/models/collections/map-view.ts +6 -2
- package/src/models/collections/set-view.ts +7 -2
- package/src/models/index.ts +1 -1
- package/src/models/iterators/smart-async-iterator.ts +1 -1
- package/src/models/iterators/smart-iterator.ts +1 -1
- package/src/models/json/json-storage.ts +3 -3
- package/src/models/promises/deferred-promise.ts +7 -2
- package/src/models/promises/index.ts +2 -1
- package/src/models/promises/promise-queue.ts +222 -0
- package/src/models/promises/smart-promise.ts +1 -1
- package/src/models/timers/clock.ts +2 -8
- package/src/models/timers/countdown.ts +2 -3
- package/src/models/timers/game-loop.ts +4 -8
|
@@ -7,7 +7,7 @@ import type { Callback } from "../types.js";
|
|
|
7
7
|
|
|
8
8
|
import GameLoop from "./game-loop.js";
|
|
9
9
|
|
|
10
|
-
interface
|
|
10
|
+
interface CountdownEventsMap
|
|
11
11
|
{
|
|
12
12
|
start: () => void;
|
|
13
13
|
stop: (reason: unknown) => void;
|
|
@@ -43,7 +43,7 @@ export default class Countdown extends GameLoop
|
|
|
43
43
|
/**
|
|
44
44
|
* The {@link Publisher} object that will be used to publish the events of the countdown.
|
|
45
45
|
*/
|
|
46
|
-
protected
|
|
46
|
+
declare protected readonly _publisher: Publisher<CountdownEventsMap>;
|
|
47
47
|
|
|
48
48
|
/**
|
|
49
49
|
* The total duration of the countdown in milliseconds.
|
|
@@ -114,7 +114,6 @@ export default class Countdown extends GameLoop
|
|
|
114
114
|
|
|
115
115
|
super(callback, msIfNotBrowser);
|
|
116
116
|
|
|
117
|
-
this._publisher = new Publisher();
|
|
118
117
|
this._duration = duration;
|
|
119
118
|
}
|
|
120
119
|
|
|
@@ -3,15 +3,11 @@ import { isBrowser } from "../../helpers.js";
|
|
|
3
3
|
|
|
4
4
|
import Publisher from "../callbacks/publisher.js";
|
|
5
5
|
import { FatalErrorException, RuntimeException } from "../exceptions/index.js";
|
|
6
|
-
import type { Callback } from "../types.js";
|
|
7
6
|
|
|
8
|
-
interface
|
|
7
|
+
interface GameLoopEventsMap
|
|
9
8
|
{
|
|
10
9
|
start: () => void;
|
|
11
10
|
stop: () => void;
|
|
12
|
-
|
|
13
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
14
|
-
[key: string]: Callback<any[], any>;
|
|
15
11
|
}
|
|
16
12
|
|
|
17
13
|
/**
|
|
@@ -98,7 +94,7 @@ export default class GameLoop
|
|
|
98
94
|
/**
|
|
99
95
|
* The {@link Publisher} object that will be used to publish the events of the game loop.
|
|
100
96
|
*/
|
|
101
|
-
protected _publisher: Publisher<
|
|
97
|
+
protected readonly _publisher: Publisher<GameLoopEventsMap>;
|
|
102
98
|
|
|
103
99
|
/**
|
|
104
100
|
* The internal method actually responsible for starting the game loop.
|
|
@@ -106,7 +102,7 @@ export default class GameLoop
|
|
|
106
102
|
* Depending on the current environment, it could use the
|
|
107
103
|
* {@link requestAnimationFrame} or the {@link setInterval} function.
|
|
108
104
|
*/
|
|
109
|
-
protected _start: () => void;
|
|
105
|
+
protected readonly _start: () => void;
|
|
110
106
|
|
|
111
107
|
/**
|
|
112
108
|
* The internal method actually responsible for stopping the game loop.
|
|
@@ -114,7 +110,7 @@ export default class GameLoop
|
|
|
114
110
|
* Depending on the current environment, it could use the
|
|
115
111
|
* {@link cancelAnimationFrame} or the {@link clearInterval} function.
|
|
116
112
|
*/
|
|
117
|
-
protected _stop: () => void;
|
|
113
|
+
protected readonly _stop: () => void;
|
|
118
114
|
|
|
119
115
|
/**
|
|
120
116
|
* Initializes a new instance of the {@link GameLoop} class.
|