Creates a debounced function that delays invoking func until after wait milliseconds have elapsed since the last time the debounced function was invoked. The func will be invoked with the context and arguments of the debounced function.
func
wait
The function to debounce.
The number of milliseconds to delay.
The function options.
Returns the new debounced function.
// Avoid costly calculations while the window size is in flux.window.addEventListener.on('resize', debounce(calculateLayout, 100)) Copy
// Avoid costly calculations while the window size is in flux.window.addEventListener.on('resize', debounce(calculateLayout, 100))
Creates a debounced function that delays invoking
func
until afterwait
milliseconds have elapsed since the last time the debounced function was invoked. Thefunc
will be invoked with the context and arguments of the debounced function.