Skip to content

@web-engine-dev/time


@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 ​

readonly duration: number

Duration of the timer in seconds


elapsed ​

readonly elapsed: number

Elapsed time in seconds


finished ​

readonly finished: boolean

Whether the timer has finished


id ​

readonly id: string

Unique identifier for the timer


paused ​

readonly paused: boolean

Whether the timer is paused


progress ​

readonly progress: number

Progress from 0 to 1


remaining ​

readonly remaining: number

Remaining time in seconds


repeating ​

readonly repeating: boolean

Whether the timer repeats


timesCompleted ​

readonly timesCompleted: number

Number of times the timer has completed

Proprietary software. All rights reserved.