useTimer API
API reference for the useTimer composable.
(handler: () => void, options?: TimerOptions) => TimerContextCreates a reactive timer with pause/resume support.
number | undefinedDuration in milliseconds.
Default: 1000
boolean | undefinedWhether the timer repeats after firing.
Default: false
ShallowRef<number>Milliseconds left until next fire.
ShallowRef<boolean>Whether the timer is currently active (started and not stopped).
ShallowRef<boolean>Whether the timer is currently paused.
() => voidStart the timer. Restarts if already running.
() => voidStop the timer and reset remaining to full duration.
() => voidPause the timer, preserving remaining time. No-op if not running.
() => voidResume from where pause left off. No-op if not paused.