Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
debounce js
const debounce = (fn, time) => {
let timerId;
return function(...args) {
const functionCall = () => fn.apply(this, args);
clearTimeout(timerId);
timerId = setTimeout(functionCall, time);
};
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment