debounce

Creates a debounced version of a function. Only calling it after a specified amount of time has passed without any new calls.

Methods:

  • cancel() will cancel the next invocation of the debounced function.
  • flush() will immediately invoke the debounced function and cancel any pending invocations.
  • pending() returns true if the debounced function is set to invoke.

This function can be used as a decorator with decDebounce.

Example