Timers made easy
new Timer({
'duration': '00:00:05',
'onStart': function(){
console.log('Empieza!')
},
'onTick': function(time, timeDiff){
console.log(time, timeDiff)
},
'onEnd': function(){
console.log('Fin!')
}
})
You can see it in action here
Param | value | description |
---|---|---|
duration|string
Format: 00:00:00
| Regressive count. If null
, undefined
or 00:00:00
the timer will be infinite (ascendent)
onStart|function
|Function executed at the start
onTick|function
|Function executed each tick (time
, timeDiff
milliseconds difference since las tick)
onEnd|function
|Function executed at the end
Method | Description |
---|---|
resetTime
|Resets the time leftrunTimer
|Starts the timergetTimeLeft
|Returns the time left in an object{ hours: 0, minutes: 0, seconds: 0 }
reset
|Resets and run the timerstop
|Stops the timer