Documentation
    Preparing search index...

    Interface Clockable

    The contract a timeline uses to tell the time.

    A timeline only needs three things from a clock: read the current time, wait for time to pass, and advance time. The built-in Clock implements this with a deterministic frame counter, but you can supply any implementation — for example one backed by a fake-timers library so the timeline shares a clock with the real setInterval/setTimeout timers inside the code under test. See the README's "Driving real timers" section.

    interface Clockable {
        now: number;
        advance(frames?: number): void | Promise<void>;
        wait(frames: number): Promise<void>;
    }
    Index

    Properties

    Methods

    Properties

    now: number

    The current virtual time, measured in frames.

    Methods

    • Advances virtual time by frames (default 1). May be asynchronous so that implementations backed by real/fake timers can flush pending timer callbacks and microtasks while advancing.

      Parameters

      • Optionalframes: number

      Returns void | Promise<void>

    • Returns a promise that resolves once the clock has advanced by frames frames.

      Parameters

      • frames: number

      Returns Promise<void>