Co-authored-by: manus <manus@noreply.143.198.27.163> Co-committed-by: manus <manus@noreply.143.198.27.163>
11 lines
241 B
JavaScript
11 lines
241 B
JavaScript
export class Ticker {
|
|
constructor() {
|
|
this.callbacks = [];
|
|
}
|
|
subscribe(fn) { this.callbacks.push(fn); }
|
|
tick(delta, elapsed) {
|
|
this.callbacks.forEach(fn => fn(delta, elapsed));
|
|
}
|
|
}
|
|
export const globalTicker = new Ticker();
|