API reference

Every public class, method, and event in @codexo/exojs. Generated from source.

C

classClock

@codexo/exojs / core / stable

High-precision clock that accumulates elapsed time while running. Reads the host's monotonic clock unless a TimeSource is supplied - pass an application's platform adapter to follow its time, or any object with a `now()` to drive the clock deterministically from a test. Use Clock.start, Clock.stop, Clock.reset, and Clock.restart to control the running state; read elapsed time via Clock.elapsedSeconds. Use Timer for a clock with a fixed limit and `expired` flag.

5
props
5
methods
0
events
Import
import { Clock } from '@codexo/exojs'

High-precision clock that accumulates elapsed time while running. Reads the host's monotonic clock unless a TimeSource is supplied - pass an application's platform adapter to follow its time, or any object with a `now()` to drive the clock deterministically from a test. Use Clock.start, Clock.stop, Clock.reset, and Clock.restart to control the running state; read elapsed time via Clock.elapsedSeconds.

Use Timer for a clock with a fixed limit and `expired` flag.

Constructors1
Methods5
destroy(): void
reset(): this
Halt and zero the accumulated time. The clock is left stopped.
restart(): this
Reset accumulated time to zero, then immediately start. Common per-frame pattern.
start(): this
Begin accumulating time. No-op when already running.
stop(): this
Halt accumulation. Elapsed time stays at the moment of stopping.
Properties5
elapsedHours: number
Clock.elapsedMilliseconds in hours.
Total accumulated time since the last Clock.reset. While the clock is running the value advances on every read, folding in the interval since the previous one; while stopped it stays at the moment of stopping.
elapsedMinutes: number
Clock.elapsedMilliseconds in minutes.
running: boolean
Source