The function to debounce. Will receive any arguments passed to the debounced function.
Rest
...args: any[]The number of milliseconds to delay execution after the last call.
Optional
immediate: booleanIf true, the function will execute immediately on the first call, then start the debounce behavior for subsequent calls.
Optional
maxWait: numberThe maximum time the function can be delayed before it's forcibly executed. If specified, the function will be called after this many milliseconds have passed since its last execution, regardless of the debounce wait time.
Rest
...args: any[]Generated using TypeDoc
Creates a debounced version of a function that delays invoking the provided function until after a specified wait time has elapsed since the last time it was invoked.
Returns
A debounced version of the original function that has the following behavior:
wait
milliseconds have passed since the last callimmediate
is true, executes on the leading edge of the first callmaxWait
is provided, ensures the function is called at least once everymaxWait
millisecondsthis
context and arguments of the most recent callExample