FrameLoop: its internal types
Interfaces
Run()
run's and runLast's shape: a run given a token can also end Superseded.
Call Signature
Run<F>(machine, sink): Effect<F>;run's and runLast's shape: a run given a token can also end Superseded.
Type Parameters
F
F extends Frame<unknown>
Parameters
machine
Machine<F>
sink
Sink<F>
Returns
Effect<F>
Call Signature
Run<F>(
machine,
sink,
options
): Effect<typeof Superseded | F>;run's and runLast's shape: a run given a token can also end Superseded.
Type Parameters
F
F extends Frame<unknown>
Parameters
machine
Machine<F>
sink
Sink<F>
options
Returns
Effect<typeof Superseded | F>
RunOptions
A run's options: the token it joins, so its caller can end it with others.
Properties
supersede
readonly supersede: Supersede;The token: Supersede.end on it ends every run that joined it.
Shape
The Frame loop's members: what FrameLoop gives.
Properties
afterTick
readonly afterTick: (hook) => Effect<void, never, Scope>;Calls hook at the end of every tick, after every run's step and sink and the continuations of the
runs that settled in it, until the Scope closes. Hooks run in the order they were added. A plain
call, typed like a Sink, so a hook that returns an Effect doesn't compile. A hook doesn't throw:
one that does fails the tick, and with it every run on the loop.
Parameters
hook
() => undefined
Returns
Effect<void, never, Scope>
run
readonly run: Run;Runs machine on the loop, handing each of its Frames to sink, from the loop's next tick until it
settles. Succeeds with the settled Frame; a machine that never settles, chase, runs until it's
interrupted or superseded. Dies with the defect if its step or its sink throws. Interrupting it
removes it at once.
Given a Supersede token ({ supersede }), the run joins it, and Supersede.end(token) ends it at
once, as an interrupt would, but its fiber succeeds with Superseded.
runLast
readonly runLast: Run;run, but stepped after every run run added, in each tick: for a machine that reads what the
others' sinks wrote in the same tick. Among themselves, these runs step in the order they were added.