@rikal87/time-watch
v1.2.2
Published
[MIT (The MIT License)](LICENSE.md)
Downloads
3
Maintainers
Readme
HOW TO USE
You can use almost the same syntax as HTML5 <video>
control API.
const TimeWatch = require('@rikal87/time-watch')
const tw = new TimeWatch()
let cnt = 3
tw.interval = 500
tw.duration = 3000
tw.loop = false
tw.ontick = function () {
console.log('tick:', this.currentTime)
if(cnt === 0) this.pause()
}
tw.onended = function () {
console.log('done!')
this.play()
}
tw.onplay = function () {
--cnt
}
tw.onpause = function () {
console.log('onpause')
}
tw.play()