The function to debounce
The number of milliseconds to delay
Optional
options:
{ The options object
Optional
leading?: boolean
Specify invoking on the leading edge of the timeout
Optional
max
The maximum time func
is allowed to be delayed
before it's invoked
Optional
trailing?: boolean
Specify invoking on the trailing edge of the timeout
Returns the new debounced function
Generated using TypeDoc
Creates a debounced function that delays invoking
func
until afterwait
milliseconds have elapsed since the last time the debounced function was invoked, or until the next browser frame is drawn. Provideoptions
to indicate whetherfunc
should be invoked on the leading and/or trailing edge of thewait
timeout. Thefunc
is invoked with the last arguments provided to the debounced function. Subsequent calls to the debounced function return the result of the lastfunc
invocation. Note: Ifleading
andtrailing
options aretrue
,func
is invoked on the trailing edge of the timeout only if the debounced function is invoked more than once during thewait
timeout. Ifwait
is0
andleading
isfalse
,func
invocation is deferred until the next tick, similar tosetTimeout
with a timeout of0
.