Created
July 20, 2012 17:41
-
-
Save natflow/3152155 to your computer and use it in GitHub Desktop.
deferred interval
This file contains 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
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