Last active
March 19, 2019 20:39
-
-
Save corycook/fc8f14be6bc97f5ce34c3ff66faa4b6c to your computer and use it in GitHub Desktop.
A really simple debounce function.
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
| function debounce(fn, ms) { | |
| let id; | |
| return function() { | |
| clearTimeout(id); | |
| id = setTimeout(() => fn.apply(this, arguments), ms); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment