Once
View sourceComplete after the first duration and remain at the duration.
Enum
Defines how Timer behaves when a cycle reaches its duration.
One-shot behavior stops at the duration and reports completion. Repeating behavior wraps to the next cycle and continues counting completed cycles.
import { Timer, TimerMode } from '@wimaengine/time'
const once = new Timer({ duration: 1, mode: TimerMode.Once })
once.update(1.25)
console.log(once.elapsed(), once.completed()) // 1, true
const repeat = new Timer({ duration: 1, mode: TimerMode.Repeat })
repeat.update(1.25)
console.log(repeat.elapsed(), repeat.cyclesCompleted()) // 0.25, 1Complete after the first duration and remain at the duration.
Wrap at each duration and continue counting completed cycles.