export type TimerPoolEntry = { type: 'timeout'; id: ReturnType; } | { type: 'interval'; id: ReturnType; } | { type: 'raf'; id: ReturnType; }; export interface TimersAPI { setTimeout: typeof setTimeout; clearTimeout: typeof clearTimeout; setInterval: typeof setInterval; clearInterval: typeof clearInterval; requestAnimationFrame: typeof requestAnimationFrame; cancelAnimationFrame: typeof cancelAnimationFrame; } export interface TimerPoolOptions { /** Timers API. By default global functions will be used. */ timersAPI?: TimersAPI; } /** * Timer pool. * Primarily exists for able to clear all registered timers. */ export declare class TimerPool { protected api: TimersAPI; protected timers: Set; constructor(options?: TimerPoolOptions); setTimeout(callback: VoidFunction, ms?: number): ReturnType; setInterval(callback: VoidFunction, ms?: number): ReturnType; requestAnimationFrame(callback: FrameRequestCallback): ReturnType; clearAll(): void; }