-
-
Save sagartalla/8d320f317bd342cdd9f45cbe5d54a044 to your computer and use it in GitHub Desktop.
Debounce Polyfill
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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