export type PausableIntervalParams = { /** * Invoked on each interval completed. */ callback: () => void; /** * Length of the interval delay in milliseconds. */ delayMs: number; /** * This optional function can be provided to generate a custom initial interval delay. * This will be invoked on each "stopAndReset" invocation. */ getFirstDelayMs?: () => number; /** * The maximum amount of interval drift to account for in the next interval in milliseconds * before resetting back to the default interval delay as a safety mechanism. This number should never exceed "delayMS". */ maxDriftBeforeResetMs: number; }; export type PausableInterval = { /** * Pauses an interval while saving progress. Calling "start" again will resume * the interval with the remaining duration of "delayMs". */ pause: () => void; /** * Initiates a new interval or resumes from where one was last stopped if there * isn't already one in progress. * @param callback Invoked when the interval completes. */ start: () => void; /** * Stops a currently active interval and resets back to an initial state that * will use firstDelayMs if provided. */ stopAndReset: () => void; }; /** * A utility for creating long-running "intervals" that can be paused/resumed and have * drift correction to account for the single-threaded nature of JavaScript. * * Interval timing does not begin until "start" is invoked. */ export declare function createPausableInterval({ callback, delayMs, getFirstDelayMs, maxDriftBeforeResetMs, }: PausableIntervalParams): PausableInterval; //# sourceMappingURL=index.d.ts.map