SimulatedClock
Defined in: console-sdk/src/testing/simulatedClock.ts:54
The deterministic test clock (SDK_PLAN.md §3.11.2 / §4.8.1). It implements the same Clock interface production uses, so the entire runtime — connect timeouts, reconnect backoff, correlator budgets, link health checks, coalesced store commits, simulated-console frame emission — runs unmodified above it.
Only durations are ever gated: scan surfacing, connect() settling, state
flips, and frame delivery resolve via the microtask queue without any
advance (§3.11.2’s clock-gating table).
Extends
Section titled “Extends”Methods
Section titled “Methods”advance()
Section titled “advance()”advance(
ms):Promise<void>
Defined in: console-sdk/src/testing/simulatedClock.ts:77
Advance simulated time by ms milliseconds, firing every due timeout,
interval tick, and frame in timestamp order (FIFO within one timestamp)
and awaiting a microtask flush between entries, so promise chains
started by each callback settle before the next entry fires. Work
scheduled during the walk (cascaded timers, interval reschedules, new
frames) fires in the same call when it falls inside the window.
Resolves with now() at exactly start + ms. Rejects with RangeError
for negative or non-finite ms, and with Error when another
advance() is still in flight (the walk is not reentrant). A callback
that throws rejects the walk at that entry — simulated time rests at the
failing entry’s timestamp, remaining entries stay queued, and the clock
remains usable.
Parameters
Section titled “Parameters”number
Returns
Section titled “Returns”Promise<void>
cancelFrame()
Section titled “cancelFrame()”cancelFrame(
handle):void
Defined in: console-sdk/src/runtime/clock.ts:73
Cancel a pending frame request. Safe to call after it has fired.
Parameters
Section titled “Parameters”handle
Section titled “handle”FrameHandle
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”Clock.cancelFrame
clearInterval()
Section titled “clearInterval()”clearInterval(
handle):void
Defined in: console-sdk/src/runtime/clock.ts:64
Cancel a repeating timer. Safe to call more than once.
Parameters
Section titled “Parameters”handle
Section titled “handle”IntervalHandle
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”Clock.clearInterval
clearTimeout()
Section titled “clearTimeout()”clearTimeout(
handle):void
Defined in: console-sdk/src/runtime/clock.ts:60
Cancel a pending one-shot timer. Safe to call after it has fired.
Parameters
Section titled “Parameters”handle
Section titled “handle”TimeoutHandle
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”Clock.clearTimeout
now():
number
Defined in: console-sdk/src/testing/simulatedClock.ts:60
Current simulated time in milliseconds. Starts at the configured epoch
(default 0) and moves only through SimulatedClock.advance —
inside a scheduled callback it reads exactly that entry’s fire time.
Returns
Section titled “Returns”number
Overrides
Section titled “Overrides”Clock.now
requestFrame()
Section titled “requestFrame()”requestFrame(
callback):FrameHandle
Defined in: console-sdk/src/runtime/clock.ts:71
Schedule callback for the next animation frame (used by the
frame-coalesced stores, §4.5.1). frameTimeMs is the platform frame
timestamp — its timebase is platform-defined, so use it only for
intra-frame deltas, never mix it with Clock.now.
Parameters
Section titled “Parameters”callback
Section titled “callback”(frameTimeMs) => void
Returns
Section titled “Returns”FrameHandle
Inherited from
Section titled “Inherited from”Clock.requestFrame
setInterval()
Section titled “setInterval()”setInterval(
callback,intervalMs):IntervalHandle
Defined in: console-sdk/src/runtime/clock.ts:62
Schedule callback to run every intervalMs milliseconds.
Parameters
Section titled “Parameters”callback
Section titled “callback”() => void
intervalMs
Section titled “intervalMs”number
Returns
Section titled “Returns”IntervalHandle
Inherited from
Section titled “Inherited from”Clock.setInterval
setTimeout()
Section titled “setTimeout()”setTimeout(
callback,delayMs):TimeoutHandle
Defined in: console-sdk/src/runtime/clock.ts:58
Schedule callback to run once, delayMs milliseconds from now.
Parameters
Section titled “Parameters”callback
Section titled “callback”() => void
delayMs
Section titled “delayMs”number
Returns
Section titled “Returns”TimeoutHandle
Inherited from
Section titled “Inherited from”Clock.setTimeout