For most things a simple setTimeout()
or setInterval()
is enough - but Javascript timers get throttled when the page is minimised/tabbed out of and you will end up with imprecise timings in the long run. This is where AloTimer comes in - you set a timer and poll it with as much precision as you need - while individual polling calls might get throttled, the end result will always be accurate.
Functionality
- Add or subtract any amount of miliseconds/seconds/minutes/hours/days
- Get the amount of any of the above left individually
- Output time left as a DD:HH:mm:ss string (customisable)
- A simple check whether the timeout has finished
- Pause and unpause the timer
Installation
Or, if you prefer Node,
npm install alo-timer --save
Usage example
var span = document timer = 3600000 "hours" "minutes" "seconds" // 1 hr { if !timerhasFinished spaninnerText = timer; else spaninnerText = "YOUR SCHNITZEL IS DONE!"; ; } interval = ;
More information: