debounce
debounce<
T>(params):Debounced<T>
Defined in: async/debounce/index.ts:24
Creates a debounced version of a function that delays invocation until
after ms milliseconds have elapsed since the last call.
Type Parameters
Section titled “Type Parameters”T extends (…args) => unknown
Parameters
Section titled “Parameters”params
Section titled “params”DebounceParams<T>
The parameters object
Returns
Section titled “Returns”Debounced<T>
The debounced function with a .cancel() method
Example
Section titled “Example”const debouncedFn = debounce({ fn: search, ms: 300 });debouncedFn("query");debouncedFn.cancel(); // cancel pending callKeywords
Section titled “Keywords”delay call, wait idle, input delay, search delay
Throws
Section titled “Throws”Error if fn is not a function
Throws
Section titled “Throws”Error if ms is not a number or is negative