Creates a debounced function that delays invoking func until after wait milliseconds have elapsed since the last time the debounced function was invoked. The debounced function comes with a cancel method to cancel delayed func invocations. The func is invoked with the last arguments provided to the debounced function.
If wait is 0, func invocation is deferred until to the next tick, similar to setTimeout with a timeout of 0.
Differences from lodash:
the debounced function does not come with a flush method
does not accept options
does not return the results of the last invocation
does not make any guarantees about the value of this in func
Contribution to minified bundle size, when it is the only function imported:
Creates a debounced function that delays invoking
funcuntil afterwaitmilliseconds have elapsed since the last time the debounced function was invoked. The debounced function comes with acancelmethod to cancel delayedfuncinvocations. Thefuncis invoked with the last arguments provided to the debounced function.If
waitis 0,funcinvocation is deferred until to the next tick, similar tosetTimeoutwith a timeout of0.Differences from lodash:
flushmethodthisinfuncContribution to minified bundle size, when it is the only function imported: