constructor(options?: TimerOptions)
View sourceCreates a timer with an optional duration, mode, speed, and paused state.
Class
ExtendsTimer
Stores mutable time and cycle state for an application timer.
Each update advances the timer while it is active, and its cycle behavior determines whether time stops at the end of the first cycle or wraps into subsequent cycles. Pausing preserves the current position; restarting begins again from zero.
import { Timer, TimerMode } from '@wimaengine/time'
const timer = new Timer({ duration: 2, mode: TimerMode.Once })
timer.update(0.5)
timer.pause()
timer.play()
timer.update(1.5)
if (timer.completed()) {
console.log('timer finished')
}constructor(options?: TimerOptions)Creates a timer with an optional duration, mode, speed, and paused state.