-
-
Save AmesianX/248dc7798fc91cd937ba6e6baa5b0b62 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