Created
November 18, 2013 22:27
-
-
Save selahlynch/7536502 to your computer and use it in GitHub Desktop.
timer code
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
Timer.prototype.start = function() { | |
var self = this; | |
(function countdown() { | |
if (self.count > 0) { | |
var m = Math.floor(self.count / 60); | |
var s = self.count % 60; | |
self.onTick(formatTime(m),formatTime(s)); | |
self.count = self.count - 1; | |
$timeout(countdown, 1000); | |
} | |
else { | |
self.onComplete(self.tickedAtLeastOnce); | |
} | |
})(); | |
}; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment