Skip to content

Instantly share code, notes, and snippets.

@ZackFox
Created March 31, 2019 11:00
Show Gist options
  • Save ZackFox/3818d8c8eb4484754d6156f78053ea5b to your computer and use it in GitHub Desktop.
Save ZackFox/3818d8c8eb4484754d6156f78053ea5b to your computer and use it in GitHub Desktop.
function debounce(func,delay = 200){
let timer = null;
return function(...args){
if(timer){
clearTimeout(timer);
}
timer = setTimeout(() => {
func.apply(null,args)
}, delay);
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment