Created
May 22, 2020 12:07
-
-
Save kmansoft/fe0d9462302d9f705cb7474732bee91d to your computer and use it in GitHub Desktop.
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
function makeDebounce(real, interval) { | |
var timerValue; | |
return function() { | |
if (timerValue) { | |
clearTimer(timerValue) | |
} | |
timerValue = setTimer(real, interval) | |
} | |
} | |
function myRealFunction() { | |
// ... | |
} | |
foo.onchange = makeDebounce(myRealFunction, 1000); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment