small-timer
v1.1.4
Published
A count down util, support start pause resume restore methods
Downloads
3
Maintainers
Readme
SmallTimer
SmallTimer
import SmallTimer from "small-timer"
const timer = new SmallTimer(1000, 10)
timer.addEventListener(SmallTimer.TIMER, onTimer)
timer.addEventListener(SmallTimer.TIMER_COMPLETE, onComplete)
timer.start()
// timer.pause()
// timer.reset()
function onTimer(e) {
console.log('timer current count:', e.currentCount)
console.log('timer repeat count:', e.repeatCount)
console.log('timer is running:', e.running)
}
function onComplete() {
console.log('complete')
}