Last active
July 12, 2022 18:45
-
-
Save mrlemoos/e07561c427b956ff1ab9eb824170f1e9 to your computer and use it in GitHub Desktop.
Debounce function (JavaScript Vanilla)
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
let debounceTimer; | |
function debounce(callback, time) { | |
clearTimeout(debounceTimer); | |
debounceTimer = setTimeout(callback, time); | |
} | |
module.exports = debounce; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment