Skip to content

Instantly share code, notes, and snippets.

@natflow
Created July 20, 2012 17:41
Show Gist options
  • Save natflow/3152155 to your computer and use it in GitHub Desktop.
Save natflow/3152155 to your computer and use it in GitHub Desktop.
deferred interval
function deferredInterval (interval) {
return $.Deferred(function () {
var intervalID = setInterval(this.notify, interval);
this.always(clearInterval.bind(window, intervalID));
});
// don't return a promise, so callers can resolve/reject to clear it
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment