WallClockTimer
A timer returned by wallClock.setTimeout or wallClock.setInterval.
If the system clock changes while the system is awake, a deadline isn’t recalculated until the next resume from sleep.
import { WallClockTimer } from '@mobrowser/api';
Properties
nextRunTime
readonly nextRunTime: Date | undefined;
When the timer will run next, or undefined if it isn’t running.
Example
import { wallClock } from '@mobrowser/api';
const timer = wallClock.setTimeout(() => {
console.log('Time is over')
}, new Date('2026-12-01T09:00:00'))
console.log(timer.nextRunTime) // December 1, 2026, 09:00 local time
timer.stop()
console.log(timer.nextRunTime) // undefined
Methods
stop()
stop(): void;
Stops the timer for good. A stopped timer doesn’t run again. Does nothing if the timer has already stopped or fired.
Example
import { wallClock } from '@mobrowser/api';
const timer = wallClock.setTimeout(() => {
console.log('Time is over')
}, 60 * 1000)
timer.stop()
console.log(timer.isRunning()) // false
isRunning()
isRunning(): boolean;
Whether the timer is waiting to run. False once it’s stopped, or once a timeout has fired.
Example
import { wallClock } from '@mobrowser/api';
const timer = wallClock.setTimeout(() => {
console.log(timer.isRunning()) // false
}, 60 * 1000)
console.log(timer.isRunning()) // true