| 13 | } |
| 14 | |
| 15 | export class DummyTicker implements ITicker { |
| 16 | private _cb: TickerCallback | null = null |
| 17 | private _time: number = 0 |
| 18 | |
| 19 | constructor(private _interval: number = TICK_INTERVAL) { } |
| 20 | |
| 21 | public get running(): boolean { return this._cb !== null } |
| 22 | |
| 23 | public start(cb: TickerCallback): void { |
| 24 | this._cb = cb |
| 25 | } |
| 26 | public stop(): void { |
| 27 | this._cb = null |
| 28 | } |
| 29 | public now(): number { |
| 30 | return this._time |
| 31 | } |
| 32 | public tick(): void { |
| 33 | this._time += this._interval |
| 34 | if (this._cb) { |
| 35 | this._cb() |
| 36 | } |
| 37 | } |
| 38 | } |
| 39 | |
| 40 | export class IntervalTicker implements ITicker { |
| 41 | private _tid: NodeJS.Timeout | null = null |
nothing calls this directly
no outgoing calls
no test coverage detected