Follow one execution
Forwards events only between a start signal and that signal’s first stop event.
duringTick 0. Events: before.
Read this diagram
Follow each lane from left to right. Events stacked vertically share a tick; the green cursor marks the current time across every lane.
- A value
The text inside the pill is the emitted value. - Work starts
The raised chevron starts an inner run (^in the source). - The run returns
The vertical bar ends this lane’s run. - A cause is delivered
The exclamation mark belongs to this lane. - Work is interrupted
The cross marks cancellation of this run. - Current time
The line and diamond move together across all lanes. - Happening now
A highlighted event is at the current tick. - Still ahead
Muted, dashed values have not happened yet. - Time continues
The lane’s arrow is not a return marker. An empty stretch can be quiet work that is still running.
Illustrated ticks start at 0. At 1×, one illustrated tick takes one second; captions specify real durations when timing matters. A cause or interruption belongs to its lane, and other work may continue. Scroll horizontally to inspect the rest of a long timeline.
events and the outer signals Fx start concurrently in one child Scope. Only the first outer value is used; that value must itself be an Fx, whose first value closes the gate. Event values before the start signal and after the stop signal are discarded. Completion of events completes the result. A failure from events, signals, or the selected stop Fx terminates everything; closing or interrupting the returned Fx interrupts all remaining fibers and closes the private Scope.
Import
import { during } from "@typed/fx/Fx";Signatures
export declare function during<A, E, R, Start extends Fx.Any, E2, R2>(events: Fx<A, E, R>, signals: Fx<Start, E2, R2>): Fx<A, E | E2 | Fx.Error<Start>, R | R2 | Fx.Services<Start> | Scope.Scope>;Why
Push lifetimes are often controlled by other push lifetimes: a pointer move
matters between pointer-down and pointer-up, for example. during models
that gate without converting either side into polling state.
Ownership and lifetime
events and the outer signals Fx start concurrently in one child Scope.
Only the first outer value is used; that value must itself be an Fx, whose
first value closes the gate. Event values before the start signal and after
the stop signal are discarded. Completion of events completes the result.
A failure from events, signals, or the selected stop Fx terminates everything;
closing or interrupting the returned Fx interrupts all remaining fibers and
closes the private Scope.
Examples
import { during } from "@typed/fx/Fx"
import { delay } from "@typed/fx/Fx"
import { periodic, succeed } from "@typed/fx/Fx"
const pointerMoves = periodic("16 millis")
const pointerDown = succeed(delay(succeed(undefined), "1 second"))
const activeMoves = during(pointerMoves, pointerDown)Other public imports
These import paths expose the same declaration. Each page retains its own public name and signature.