error-flux
Version:
Network request interceptor and logger for web applications
13 lines (12 loc) • 593 B
TypeScript
/**
* Executes a low-priority task in the background without affecting the main thread.
* Uses requestIdleCallback when available, falling back to setTimeout for older browsers.
*
* @param callback - The function to execute as a low priority task
* @param options - Optional configuration for the task execution
* @param options.timeout - Maximum delay (in ms) before the callback must be invoked
* @returns A function that can be called to cancel the scheduled task
*/
export declare function runLowPriorityTask(callback: () => void, options?: {
timeout?: number;
}): () => void;