Created
May 1, 2015 21:31
-
-
Save jehoshua02/314954ab31e9cc0fcd98 to your computer and use it in GitHub Desktop.
Primitive 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
var debounce = (function () { | |
var timeouts = {}; | |
return function (id, callback) { | |
if (timeouts[id]) { | |
clearTimeout(timeouts[id]); | |
} | |
timeouts[id] = setTimeout(callback, 300); | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment