@dfinity/utils
Version:
A collection of utilities and constants for NNS/SNS projects.
13 lines (12 loc) • 758 B
TypeScript
/**
* Creates a debounced version of the provided function.
*
* The debounced function postpones its execution until after a certain amount of time
* has elapsed since the last time it was invoked. This is useful for limiting the rate
* at which a function is called (e.g. in response to user input or events).
*
* @param {Function} func - The function to debounce. It will only be called after no new calls happen within the specified timeout.
* @param {number} [timeout=300] - The debounce delay in milliseconds. Defaults to 300ms if not provided or invalid.
* @returns {(args: unknown[]) => void} A debounced version of the original function.
*/
export declare const debounce: (func: Function, timeout?: number) => (...args: unknown[]) => void;