UNPKG

timeout-flow

Version:

Fluent, composable, pauseable JavaScript timers and time control flows — plus RAF utilities for frame-based logic.

15 lines (14 loc) 586 B
/** * @typedef {((...args: any[]) => void) & { cancel: () => void }} DebouncedFunction */ /** * Creates a debounced function that delays invoking `fn` until after `delay` ms. * * @param {number|Function} a - Delay in ms or the function to debounce. * @param {number|Function} [b] - The function to debounce, if delay is first * @returns {DebouncedFunction} A debounced function with `.cancel()` */ export function debounce(a: number | Function, b?: number | Function): DebouncedFunction; export type DebouncedFunction = ((...args: any[]) => void) & { cancel: () => void; };