Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
A modern twist to an oldie, but goldie.
export function debounce(func, timeout = 300){
let timer;
return (...args) => {
clearTimeout(timer);
timer = setTimeout(() => { func.apply(this, args); }, timeout);
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment