| 7 | const SIMPLE_CLOCK = new SimpleClock(); |
| 8 | |
| 9 | export class ClockAPI { |
| 10 | private static _instance?: ClockAPI; |
| 11 | |
| 12 | private constructor() {} |
| 13 | |
| 14 | public static getInstance(): ClockAPI { |
| 15 | if (!this._instance) { |
| 16 | this._instance = new ClockAPI(); |
| 17 | } |
| 18 | |
| 19 | return this._instance; |
| 20 | } |
| 21 | |
| 22 | public setGlobalClock(clock: Clock): boolean { |
| 23 | return registerGlobal(API_NAME, clock); |
| 24 | } |
| 25 | |
| 26 | public preciseNow(): ClockTime { |
| 27 | return this.#getClock().preciseNow(); |
| 28 | } |
| 29 | |
| 30 | public reset(): void { |
| 31 | this.#getClock().reset(); |
| 32 | } |
| 33 | |
| 34 | #getClock(): Clock { |
| 35 | return getGlobal(API_NAME) ?? SIMPLE_CLOCK; |
| 36 | } |
| 37 | } |
nothing calls this directly
no outgoing calls
no test coverage detected
searching dependent graphs…