Skip to content

Instantly share code, notes, and snippets.

@jehoshua02
Created May 1, 2015 21:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jehoshua02/314954ab31e9cc0fcd98 to your computer and use it in GitHub Desktop.
Save jehoshua02/314954ab31e9cc0fcd98 to your computer and use it in GitHub Desktop.
Primitive debounce function.
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