Skip to content

Instantly share code, notes, and snippets.

@selahlynch
Created November 18, 2013 22:27
Show Gist options
  • Save selahlynch/7536502 to your computer and use it in GitHub Desktop.
Save selahlynch/7536502 to your computer and use it in GitHub Desktop.
timer code
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