Skip to content

Timer

Defined in: packages/core/src/time/timer.ts:5

A reusable timer that calls a callback function after a specified delay.

new Timer(callback, delayMs): Timer

Defined in: packages/core/src/time/timer.ts:14

Constructs a new Timer.

Callable

The function to call when the timer fires.

number

The delay in milliseconds before the timer fires.

Timer

cancel(): void

Defined in: packages/core/src/time/timer.ts:39

Cancels the timer. If the timer is not active, this does nothing.

void


isActive(): boolean

Defined in: packages/core/src/time/timer.ts:25

Returns whether the timer is currently active (i.e., has been started and not yet fired or canceled).

boolean

True if the timer is active, false otherwise.


restart(): void

Defined in: packages/core/src/time/timer.ts:47

Restarts the timer. If the timer is not active, this starts it.

void


start(): void

Defined in: packages/core/src/time/timer.ts:30

Starts the timer. If the timer is already active, this does nothing.

void