| 38 | } |
| 39 | |
| 40 | export class IntervalTicker implements ITicker { |
| 41 | private _tid: NodeJS.Timeout | null = null |
| 42 | |
| 43 | public constructor(public interval: number = TICK_INTERVAL) { } |
| 44 | |
| 45 | public get running(): boolean { return this._tid != null } |
| 46 | public start(cb: TickerCallback): void { |
| 47 | this.stop() |
| 48 | this._tid = setInterval(cb, this.interval) |
| 49 | } |
| 50 | public stop(): void { |
| 51 | if (this._tid) { |
| 52 | clearInterval(this._tid) |
| 53 | this._tid = null |
| 54 | } |
| 55 | } |
| 56 | public now(): number { return Date.now() } |
| 57 | } |
| 58 | |
| 59 | export class AnimationFrameTicker implements ITicker { |
| 60 | private _rafid: number = 0 |
nothing calls this directly
no outgoing calls
no test coverage detected