Last active
August 29, 2015 14:14
-
-
Save A/4bda5e1983bfad2b06ff to your computer and use it in GitHub Desktop.
Pomodoro algorythm
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
var session = 25 * 60 * 1000; // pomodoro session | |
var start = Number(new Date()); // set start time | |
var finish = start + session; // set finish time | |
function countdown () { | |
var now = Number(new Date()); | |
var isFinished = (finish - now) > finish; | |
if (!isFinished) { | |
// check after 1 second | |
setTimeout(countdown, 1000); | |
} else { | |
// finished | |
alert('Done'); | |
} | |
}; | |
countDown(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment