Created
November 7, 2017 21:20
-
-
Save dabroder/14c070e8c44d47422103022f4bfd3508 to your computer and use it in GitHub Desktop.
small debounce implementation
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
export default (fn, delay, id = null) => (...arg) => { | |
clearTimeout(id) | |
id = setTimeout(fn, delay, ...arg) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment