UNPKG

@tanstack/db

Version:

A reactive client store for building super fast apps on sync

31 lines (30 loc) 909 B
/** * Batches many GC registrations behind a single shared timeout. */ export declare class CleanupQueue { private static instance; private tasks; private timeoutId; private microtaskScheduled; private constructor(); static getInstance(): CleanupQueue; /** * Queues a cleanup task and defers timeout selection to a microtask so * multiple synchronous registrations can share one root timer. */ schedule(key: unknown, gcTime: number, callback: () => void): void; cancel(key: unknown): void; /** * Keeps only one active timeout: whichever task is due next. */ private updateTimeout; /** * Runs every task whose deadline has passed, then schedules the next wakeup * if there is still pending work. */ private process; /** * Resets the singleton instance for tests. */ static resetInstance(): void; }