Last active
October 11, 2015 02:28
-
-
Save boo1ean/3789171 to your computer and use it in GitHub Desktop.
Delay callback for typehead
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
var delay = (function() { | |
var timer = 0; | |
return function(callback, ms) { | |
if (typeof(callback) == 'function' && typeof(ms) == 'number') { | |
clearTimeout(timer); | |
timer = setTimeout(callback, ms); | |
} | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment