@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.
@@ -7,7 +7,7 @@ import type { Callback } from "../types.js";
7
7
 
8
8
  import GameLoop from "./game-loop.js";
9
9
 
10
- interface CountdownEventMap
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 override _publisher: Publisher<CountdownEventMap>;
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 GameLoopEventMap
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<GameLoopEventMap>;
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.