Skip to content

Instantly share code, notes, and snippets.

@gabrielengel
Created February 9, 2014 15:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gabrielengel/8901129 to your computer and use it in GitHub Desktop.
Save gabrielengel/8901129 to your computer and use it in GitHub Desktop.
window.Timer = {
countdown: function(minutes,seconds){
var currentTime = new Date().getTime();
Timer.finishTime = currentTime + (minutes * 60 * 1000) + (seconds * 1000);
Timer.running = setInterval("Timer.ended()",1000)
},
ended: function(){
var currentTime = new Date().getTime();
console.log('Now: ' + currentTime + ' - ends: ' + Timer.finishTime);
if(currentTime >= Timer.finishTime){
alert('arihoo');
clearInterval(Timer.running);
}
}
}
Timer.countdown(00,15)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment