This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Debounce is used to limit the number of times a function is called in a short period of time. | |
* @param {Function} func | |
* @param {Number} wait - a delay in milliseconds, usually 250 ms by default. | |
* @returns {Function} a new function that will delay the execution of the original function. | |
*/ | |
const debounce = (func, wait = 250) => { | |
let timeout; | |
return function (event) { | |
// console.log(`debounced ${func.name} called`) |
OlderNewer