variable / @typed/fx/Fx

since

Drops events until signal emits, then forwards the rest.

Package version
2.0.0-beta.7
Category
Time and rate
Since
1.0.0

Follow one execution

Drops events until signal emits, then forwards the rest.

Fx timelinesince opens when its named start signal emitssince
Operatorsince(events, start)
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.

Event and signal runs share a child Scope. The signal observer fiber is forked but never joined: a signal failure ends that fiber and is discarded rather than delivered to the event Sink, so it does not stop events. Event completion closes the Scope; consumer interruption stops both runs.

Source implementation · Learn the surrounding model

Compare all Fx timelines →

Import

import { since } from "@typed/fx/Fx";

Signatures

export declare const since: {
    <B, E2, R2>(signal: Fx<B, E2, R2>): <A, E, R>(events: Fx<A, E, R>) => Fx<A, E | E2, R | R2>;
    <A, E, R, B, E2, R2>(events: Fx<A, E, R>, signal: Fx<B, E2, R2>): Fx<A, E | E2, R | R2>;
};

Why

since uses one Fx as a start boundary for another. Events before the first signal are dropped; after it arrives, remaining events emit in their original order. Signal values are not emitted.

Ownership and lifetime

Event and signal runs share a child Scope. The signal observer fiber is forked but never joined: a signal failure ends that fiber and is discarded rather than delivered to the event Sink, so it does not stop events. Event completion closes the Scope; consumer interruption stops both runs.

Examples

import { Fx } from "@typed/fx"

// This Effect succeeds with []; the failed signal neither opens the gate nor fails collection.
const program = Fx.collectAll(Fx.since(Fx.fromIterable([1, 2]), Fx.fail("signal failed")))

Other public imports

These import paths expose the same declaration. Each page retains its own public name and signature.

Source