Skip to content

Instantly share code, notes, and snippets.

@lstanard
Created March 18, 2014 14:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save lstanard/9620753 to your computer and use it in GitHub Desktop.
Save lstanard/9620753 to your computer and use it in GitHub Desktop.
Call window resize event only when finished
// Call window resize function only once finished
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