Skip to content

Instantly share code, notes, and snippets.

@abhinavnigam2207
Created March 5, 2019 12:20
Show Gist options
  • Save abhinavnigam2207/ecac54352f8f94db7a1a65d1d30e13d2 to your computer and use it in GitHub Desktop.
Save abhinavnigam2207/ecac54352f8f94db7a1a65d1d30e13d2 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