function / @typed/fx

Subject.multicast

Multicasts an Fx without replaying values that arrived before a subscriber joined.

Package version
2.0.0-beta.7
Category
Sharing sources
Since
1.0.0
Member of
Subject

Import

import { Subject } from "@typed/fx";

Access Subject.multicast through the imported Subject export. Its declaration below describes the member.

This public exposure is a re-export. Its import path is supported; declaration documentation is shared with the other public exposures below.

Signatures

export declare function multicast<A, E, R>(fx: Fx.Fx<A, E, R>): Fx.Fx<A, E, R | Scope.Scope>;

Why

multicast is the zero-retention sharing policy: simultaneous subscribers share source work, while consumers that arrive later receive only later publications.

Ownership and lifetime

The first subscriber starts one source execution and the last subscriber interrupts it. A later subscriber starts a fresh execution. No replay buffer is retained. Source errors and services are preserved, and Scope owns each subscription.

Examples

import { Fx } from "@typed/fx"
import * as Subject from "@typed/fx/Subject"

const sharedTicks = Subject.multicast(Fx.periodic("1 second"))

Other public imports

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

Source