https://github.com/naoxink/timer
Timers made easy
https://github.com/naoxink/timer
countdown-timer intervals javascript timers
Last synced: 8 months ago
JSON representation
Timers made easy
- Host: GitHub
- URL: https://github.com/naoxink/timer
- Owner: naoxink
- License: mit
- Created: 2018-05-14T12:26:10.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-05-16T11:56:53.000Z (over 7 years ago)
- Last Synced: 2024-12-30T03:52:18.571Z (9 months ago)
- Topics: countdown-timer, intervals, javascript, timers
- Language: JavaScript
- Homepage: http://naoxink.epizy.com
- Size: 6.84 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Timer
### Usage example
```javascript
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](http://naoxink.hol.es/idletea/?lang=en)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 endMethods
---|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