项目作者: naoxink

项目描述 :
Timers made easy
高级语言: JavaScript
项目地址: git://github.com/naoxink/timer.git
创建时间: 2018-05-14T12:26:10Z
项目社区:https://github.com/naoxink/timer

开源协议:MIT License

下载


Timer

Usage example

  1. new Timer({
  2. 'duration': '00:00:05',
  3. 'onStart': function(){
  4. console.log('Empieza!')
  5. },
  6. 'onTick': function(time, timeDiff){
  7. console.log(time, timeDiff)
  8. },
  9. 'onEnd': function(){
  10. console.log('Fin!')
  11. }
  12. })

You can see it in action here

Options

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

Methods

Method Description

resetTime|Resets the time left
runTimer|Starts the timer
getTimeLeft|Returns the time left in an object{ hours: 0, minutes: 0, seconds: 0 }
reset|Resets and run the timer
stop|Stops the timer