Created
March 5, 2019 12:20
-
-
Save abhinavnigam2207/ecac54352f8f94db7a1a65d1d30e13d2 to your computer and use it in GitHub Desktop.
Debounce Polyfill
This file contains 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