@web-engine-dev/time / Timer
Interface: Timer
Timer state
Example
typescript
function checkTimer(timer: Timer): void {
if (timer.finished) {
console.log('Timer complete!');
} else {
console.log(`Progress: ${(timer.progress * 100).toFixed(0)}%`);
}
}Properties
duration
readonlyduration:number
Duration of the timer in seconds
elapsed
readonlyelapsed:number
Elapsed time in seconds
finished
readonlyfinished:boolean
Whether the timer has finished
id
readonlyid:string
Unique identifier for the timer
paused
readonlypaused:boolean
Whether the timer is paused
progress
readonlyprogress:number
Progress from 0 to 1
remaining
readonlyremaining:number
Remaining time in seconds
repeating
readonlyrepeating:boolean
Whether the timer repeats
timesCompleted
readonlytimesCompleted:number
Number of times the timer has completed