@byloth/core 1.5.3 → 2.0.0-rc.1
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.js +521 -364
- package/dist/core.js.map +1 -1
- package/dist/core.umd.cjs +2 -2
- package/dist/core.umd.cjs.map +1 -1
- package/package.json +8 -8
- package/src/helpers.ts +3 -0
- package/src/index.ts +16 -4
- package/src/models/aggregators/reduced-iterator.ts +2 -2
- package/src/models/exceptions/core.ts +3 -4
- package/src/models/exceptions/index.ts +41 -1
- package/src/models/game-loop.ts +83 -0
- package/src/models/index.ts +10 -4
- package/src/models/iterators/smart-async-iterator.ts +3 -1
- package/src/models/iterators/smart-iterator.ts +3 -1
- package/src/models/json/index.ts +3 -0
- package/src/models/{json-storage.ts → json/json-storage.ts} +39 -26
- package/src/models/json/types.ts +3 -0
- package/src/models/publisher.ts +39 -0
- package/src/models/timers/clock.ts +47 -0
- package/src/models/timers/countdown.ts +81 -0
- package/src/models/timers/index.ts +4 -0
- package/src/models/types.ts +9 -0
- package/src/utils/date.ts +4 -4
- package/src/utils/index.ts +1 -1
- package/src/models/subscribers.ts +0 -35
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { ReferenceException } from "./exceptions/index.js";
|
|
2
|
-
|
|
3
|
-
export default class Subscribers<P extends unknown[] = [], R = void, T extends (...args: P) => R = (...args: P) => R>
|
|
4
|
-
{
|
|
5
|
-
protected _subscribers: T[];
|
|
6
|
-
|
|
7
|
-
public constructor()
|
|
8
|
-
{
|
|
9
|
-
this._subscribers = [];
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
public add(subscriber: T): void
|
|
13
|
-
{
|
|
14
|
-
this._subscribers.push(subscriber);
|
|
15
|
-
}
|
|
16
|
-
public remove(subscriber: T): void
|
|
17
|
-
{
|
|
18
|
-
const index = this._subscribers.indexOf(subscriber);
|
|
19
|
-
if (index < 0)
|
|
20
|
-
{
|
|
21
|
-
throw new ReferenceException("Unable to remove the requested subscriber. It was not found.");
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
this._subscribers.splice(index, 1);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
public call(...args: P): R[]
|
|
28
|
-
{
|
|
29
|
-
return this._subscribers
|
|
30
|
-
.slice()
|
|
31
|
-
.map((subscriber) => subscriber(...args));
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
public get [Symbol.toStringTag]() { return "Subscribers"; }
|
|
35
|
-
}
|