Cotal TypeScript packages
    Preparing search index...

    Class RunClock

    The run clock, per branch.

    now() is the maximum endedAt over the effects that causally precede the call, meaning the ones this point actually awaited. Sequentially that is the previous effect's end; after joining concurrent branches it is the maximum over all of them; inside a branch it is that branch's own history. Deterministic under replay in every case, which is what makes "time advances only at effect boundaries" a property of the design rather than a convention authors have to respect.

    A journal-wide max would NOT do: it would let a sibling branch's completion leak into a branch that never awaited it, and live execution and replay would then disagree.

    Index
    • Advance past an effect this branch awaited. Monotone: an out-of-order settle cannot rewind.

      Parameters

      • endedAt: number

      Returns void

    • Observe every forward move of THIS clock. A race subscribes to each arm's clock, because an in-flight effect that lands after the arm was cancelled advances the arm past the frontier, and the cut has to be re-decided on the fact rather than left where the settle put it. A fork does not inherit listeners: the subscriber asked about one branch, not its descendants — a nested branch's history reaches the arm's own clock at the join, which fires this then.

      Parameters

      • fn: (now: number) => void

      Returns void