Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save sagartalla/8d320f317bd342cdd9f45cbe5d54a044 to your computer and use it in GitHub Desktop.
Save sagartalla/8d320f317bd342cdd9f45cbe5d54a044 to your computer and use it in GitHub Desktop.
Debounce Polyfill
const debounce = (func, delay) => {
let clearTimer;
return function() {
const context = this;
const args = arguments;
clearTimeout(clearTimer);
clearTimer = setTimeout(() => func.apply(context, args), delay);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment