Skip to content

Instantly share code, notes, and snippets.

@benjaminsinger
Created February 5, 2015 11:00
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 benjaminsinger/fae1df3391acc19a110e to your computer and use it in GitHub Desktop.
Save benjaminsinger/fae1df3391acc19a110e to your computer and use it in GitHub Desktop.
Window Resize Fire Delay
var waitForFinalEvent = (function () {
var timers = {};
return function (callback, ms, uniqueId) {
if (!uniqueId) {
uniqueId = "Don't call this twice without a uniqueId";
}
if (timers[uniqueId]) {
clearTimeout (timers[uniqueId]);
}
timers[uniqueId] = setTimeout(callback, ms);
};
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment