Debounce a function
$ npm install debounce-fn
const debounceFn = ;windowonresize =;
Returns a debounced function that delays calling the
input function until after
wait milliseconds have elapsed since the last time the debounced function was called.
It comes with a
.cancel() method to cancel any scheduled
input function calls.
Function to debounce.
Time to wait until the
input function is called.
Trigger the function on the leading edge of the
For example, can be useful for preventing accidental double-clicks on a "submit" button from firing a second time.
Trigger the function on the trailing edge of the
- p-debounce - Debounce promise-returning & async functions