diff --git a/utilities/debounce.js b/utilities/debounce.js new file mode 100644 index 000000000..e0d4ed66a --- /dev/null +++ b/utilities/debounce.js @@ -0,0 +1,8 @@ +const debounce = (fn, time) => { + let timerId; + return function(...args) { + const functionCall = () => fn.apply(this, args); + clearTimeout(timerId); + timerId = setTimeout(functionCall, time); + }; +};