Skip to content

Instantly share code, notes, and snippets.

@mrryanjohnston
Created September 1, 2011 23:51
Show Gist options
  • Save mrryanjohnston/1187601 to your computer and use it in GitHub Desktop.
Save mrryanjohnston/1187601 to your computer and use it in GitHub Desktop.
Game.prototype.timer = function(seconds, callback) {
seconds || (seconds = 5)
var timerInterval = setInterval(function() {
if (--seconds==0) {
callback();
clearInterval(timerInterval);
}, 1000*seconds);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment