Created
April 9, 2018 15:53
-
-
Save alexstone/efe2f7f482b29e3891805172b50584cd to your computer and use it in GitHub Desktop.
Function for delaying input from a user to prevent firing events on every keyUp
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
var delay = (function(){ | |
var timer = 0; | |
return function(callback, ms) { clearTimeout (timer); timer = setTimeout(callback, ms); }; | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Used like this: