MCPcopy Create free account
hub / github.com/JavaCS3/xterm-player / DummyTicker

Class DummyTicker

src/Timer.ts:15–38  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

13}
14
15export 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
40export class IntervalTicker implements ITicker {
41 private _tid: NodeJS.Timeout | null = null

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected