Last active
July 24, 2021 23:36
-
-
Save dSalieri/6a3c1ecd8065976712102be3ff7b00df to your computer and use it in GitHub Desktop.
Light template of debounce
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 debounce(func, delay) { | |
let timerId; | |
return function (args) { | |
clearTimeout(timerId); | |
timerId = setTimeout(function () { | |
func(args); | |
}, delay); | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment