Skip to content

Instantly share code, notes, and snippets.

@amessinger
Created November 22, 2017 15:50
Show Gist options
  • Save amessinger/c25e77d179f63bec4a2e03a7dd4ed111 to your computer and use it in GitHub Desktop.
Save amessinger/c25e77d179f63bec4a2e03a7dd4ed111 to your computer and use it in GitHub Desktop.
Debounce wrapper
function debounce(func, wait) {
let timeout;
return function(...args) {
clearTimeout(timeout);
timeout = setTimeout(()=> {
func.apply(this, args);
}, wait);
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment