A list of utility functions
- debounce
The debounce function takes two arguments
- A callback function
- Timeout
You can import the package or this is made available globally you can use that.
The below example shows debouncing the user key input. The onInput method will only
get call if the user takes one second pause. This way you minimize the number of function execution.
import debounce from 'https://unpkg.com/utility-functions-js@latest/functions/debounce.js'
function onInput () {
debounce(() => alert('Hello world'), 1000)
}