@byloth/core 2.1.5 → 2.1.6
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 +1 -1
- package/dist/core.cjs.map +1 -1
- package/dist/core.esm.js +26 -95
- package/dist/core.esm.js.map +1 -1
- package/dist/core.global.js +1 -1
- package/dist/core.global.js.map +1 -1
- package/dist/core.umd.cjs +1 -1
- package/dist/core.umd.cjs.map +1 -1
- package/package.json +3 -3
- package/src/index.ts +4 -2
- package/src/models/callbacks/publisher.ts +149 -24
- package/src/models/callbacks/switchable-callback.ts +6 -6
- package/src/models/callbacks/types.ts +52 -20
- package/src/models/collections/map-view.ts +14 -15
- package/src/models/collections/set-view.ts +13 -16
- package/src/models/collections/types.ts +6 -6
- package/src/models/iterators/smart-async-iterator.ts +1 -1
- package/src/models/iterators/smart-iterator.ts +1 -1
- package/src/models/timers/clock.ts +3 -3
- package/src/models/timers/countdown.ts +4 -4
- package/src/models/timers/game-loop.ts +4 -4
- package/src/models/types.ts +9 -1
|
@@ -30,10 +30,10 @@ interface CountdownEventsMap
|
|
|
30
30
|
* ```ts
|
|
31
31
|
* const countdown = new Countdown(10_000);
|
|
32
32
|
*
|
|
33
|
-
* countdown.onStart(() =>
|
|
34
|
-
* countdown.onTick((remainingTime) =>
|
|
35
|
-
* countdown.onStop((reason) =>
|
|
36
|
-
* countdown.onExpire(() =>
|
|
33
|
+
* countdown.onStart(() => console.log("The countdown has started."));
|
|
34
|
+
* countdown.onTick((remainingTime) => console.log(`The countdown has ${remainingTime}ms remaining.`));
|
|
35
|
+
* countdown.onStop((reason) => console.log(`The countdown has stopped because of ${reason}.`));
|
|
36
|
+
* countdown.onExpire(() => console.log("The countdown has expired."));
|
|
37
37
|
*
|
|
38
38
|
* countdown.start();
|
|
39
39
|
* ```
|
|
@@ -32,8 +32,8 @@ interface GameLoopEventsMap
|
|
|
32
32
|
* console.log(`The game loop has been running for ${elapsedTime}ms.`);
|
|
33
33
|
* });
|
|
34
34
|
*
|
|
35
|
-
* loop.onStart(() =>
|
|
36
|
-
* loop.onStop(() =>
|
|
35
|
+
* loop.onStart(() => console.log("The game loop has started."));
|
|
36
|
+
* loop.onStop(() => console.log("The game loop has stopped."));
|
|
37
37
|
*
|
|
38
38
|
* loop.start();
|
|
39
39
|
* ```
|
|
@@ -226,7 +226,7 @@ export default class GameLoop
|
|
|
226
226
|
*
|
|
227
227
|
* @example
|
|
228
228
|
* ```ts
|
|
229
|
-
* loop.onStart(() =>
|
|
229
|
+
* loop.onStart(() => console.log("The game loop has started."));
|
|
230
230
|
* ```
|
|
231
231
|
*
|
|
232
232
|
* ---
|
|
@@ -247,7 +247,7 @@ export default class GameLoop
|
|
|
247
247
|
*
|
|
248
248
|
* @example
|
|
249
249
|
* ```ts
|
|
250
|
-
* loop.onStop(() =>
|
|
250
|
+
* loop.onStop(() => console.log("The game loop has stopped."));
|
|
251
251
|
* ```
|
|
252
252
|
*
|
|
253
253
|
* ---
|
package/src/models/types.ts
CHANGED
|
@@ -38,4 +38,12 @@ export type {
|
|
|
38
38
|
|
|
39
39
|
} from "./promises/types.js";
|
|
40
40
|
|
|
41
|
-
export type {
|
|
41
|
+
export type {
|
|
42
|
+
Callback,
|
|
43
|
+
CallbackMap,
|
|
44
|
+
InternalsEventsMap,
|
|
45
|
+
WildcardEventsMap,
|
|
46
|
+
Publishable,
|
|
47
|
+
Subscribable
|
|
48
|
+
|
|
49
|
+
} from "./callbacks/types.js";
|