Skip to content

@continuum-js/frp


@continuum-js/frp / StreamSource

Interface: StreamSource<A> ​

Defined in: index.ts:1426

A source stream: occurrences enter the network via .fire.

Extends ​

Type Parameters ​

A ​

A

Properties ​

onSleep ​

onSleep: (() => void) | null = null

Defined in: index.ts:447

Internal

Extra teardown run on sleep/dispose (flatten's inner subscription).

Inherited from ​

Stream.onSleep


onWake ​

onWake: (() => void) | null = null

Defined in: index.ts:445

Internal

Reseed hook run on wake, before inputs attach (lift caches).

Inherited from ​

Stream.onWake


rank ​

rank: number

Defined in: index.ts:412

Internal

Topological height in the graph (propagation order).

Inherited from ​

Stream.rank

Accessors ​

disposed ​

Get Signature ​

get disposed(): boolean

Defined in: index.ts:452

True once dispose() has run.

Returns ​

boolean

Inherited from ​

Stream.disposed

Methods ​

accum() ​

accum<B>(init, f): State<B>

Defined in: index.ts:820

Fold occurrences into a behavior. Fused: one node and one edge instead of the accumE + hold pair — every counter in every app pays half.

Type Parameters ​

B ​

B

Parameters ​

init ​

B

f ​

(a, acc) => B

Returns ​

State<B>

Inherited from ​

Stream.accum


accumE() ​

accumE<B>(init, f): Stream<B>

Defined in: index.ts:789

Fold occurrences into a stream of accumulated states. State — the fold process belongs to the ambient scope (see hold).

Type Parameters ​

B ​

B

Parameters ​

init ​

B

f ​

(a, acc) => B

Returns ​

Stream<B>

Inherited from ​

Stream.accumE


attach_() ​

attach_(target, h): Edge<any>

Defined in: index.ts:536

Internal

Closure-free subscription: returns the edge record. The handler kind must match the target (Observer for POST, Handler else) — see the Edge discriminant.

Parameters ​

target ​

Stream<any> | null

h ​

Handler<A> | Observer<A>

Returns ​

Edge<any>

Inherited from ​

Stream.attach_


consume() ​

consume<X>(input, h): void

Defined in: index.ts:696

Internal

Subscribe to input and register the teardown for dispose().

Type Parameters ​

X ​

X

Parameters ​

input ​

Stream<X>

h ​

Handler<X>

Returns ​

void

Inherited from ​

Stream.consume


dispose() ​

dispose(): void

Defined in: index.ts:710

Detach this node from its inputs (breaking the push chain so it can be collected) and drop its downstream links. Idempotent. Cascades upstream through derived intermediates that become unused, but never to sources.

Returns ​

void

Inherited from ​

Stream.dispose


ensureBiggerThan() ​

ensureBiggerThan(limit): void

Defined in: index.ts:472

Internal

Raise this node's rank above limit and propagate the bump downstream, so a node never has a rank ≤ one of its inputs. Detects dependency cycles.

Iterative on an explicit stack: a bump cascades through the entire downstream chain, and a deep chain must not overflow the call stack. onPath mirrors the recursion's path-tracking: a node met twice on ONE dfs path is a cycle; met again on a sibling path (a diamond) it is either already high enough (fast path) or bumped once more — same as the recursive formulation.

Parameters ​

limit ​

number

Returns ​

void

Inherited from ​

Stream.ensureBiggerThan


filter() ​

filter(pred): Stream<A>

Defined in: index.ts:742

Parameters ​

pred ​

(a) => boolean

Returns ​

Stream<A>

Inherited from ​

Stream.filter


fire() ​

fire(a): void

Defined in: index.ts:1428

Fire one occurrence; each fire outside batch opens a fresh moment.

Parameters ​

a ​

A

Returns ​

void


hold() ​

hold(init): State<A>

Defined in: index.ts:756

Step function: hold the last occurrence, committing at the moment boundary. State — so it needs an owner: the process that keeps the value current is registered in the ambient scope and detaches when the scope disposes (the state then answers with its final value).

Parameters ​

init ​

A

Returns ​

State<A>

Inherited from ​

Stream.hold


listen() ​

listen(h): Unlisten

Defined in: index.ts:929

Observer (phase post): fires after the moment closes, FIFO.

Parameters ​

h ​

(a) => void

Returns ​

Unlisten

Inherited from ​

Stream.listen


listen_() ​

listen_(target, h): Unlisten

Defined in: index.ts:528

Internal

Register an in-graph subscriber. Returns an unsubscribe handle.

Parameters ​

target ​

Stream<any> | null

h ​

Handler<A>

Returns ​

Unlisten

Inherited from ​

Stream.listen_


map() ​

map<B>(f): Stream<B>

Defined in: index.ts:732

Type Parameters ​

B ​

B

Parameters ​

f ​

(a) => B

Returns ​

Stream<B>

Inherited from ​

Stream.map


mapTo() ​

mapTo<B>(b): Stream<B>

Defined in: index.ts:738

Type Parameters ​

B ​

B

Parameters ​

b ​

B

Returns ​

Stream<B>

Inherited from ​

Stream.mapTo


once() ​

once(): Stream<A>

Defined in: index.ts:850

Only the first occurrence passes. A formula: cold occurrences nobody observed do not spend it; once it fired while warm, the flag persists across sleep (an observed occurrence stays observed).

Returns ​

Stream<A>

Inherited from ​

Stream.once


onDispose() ​

onDispose(fn): void

Defined in: index.ts:701

Internal

Register an extra teardown to run on dispose().

Parameters ​

fn ​

() => void

Returns ​

void

Inherited from ​

Stream.onDispose


or() ​

or(other): Stream<A>

Defined in: index.ts:881

Left-biased merge: on simultaneous occurrences the left wins.

Parameters ​

other ​

Stream<A>

Returns ​

Stream<A>

Inherited from ​

Stream.or


retain() ​

retain(): this

Defined in: index.ts:942

Performance hint: keep a pure derivation attached across listener churn instead of sleeping and re-waking (useful for a hot shared chain whose listeners come and go). Never required for correctness.

Returns ​

this

Inherited from ​

Stream.retain


send_() ​

send_(t, a): void

Defined in: index.ts:594

Internal

Push an occurrence to every current subscriber.

Parameters ​

t ​

Transaction

a ​

A

Returns ​

void

Inherited from ​

Stream.send_


source() ​

source<X>(input, h): void

Defined in: index.ts:622

Internal

Register a lazy input (see srcs).

Type Parameters ​

X ​

X

Parameters ​

input ​

Stream<X>

h ​

Handler<X>

Returns ​

void

Inherited from ​

Stream.source


subscribe() ​

subscribe<X>(input, h): Unlisten

Defined in: index.ts:691

Internal

Subscribe this node to input (rank-tracked).

Type Parameters ​

X ​

X

Parameters ​

input ​

Stream<X>

h ​

Handler<X>

Returns ​

Unlisten

Inherited from ​

Stream.subscribe


unlisten_() ​

unlisten_(rec): void

Defined in: index.ts:574

Internal

O(1) edge removal: clear the inline slot, or swap with the array's last edge and fix its index.

Parameters ​

rec ​

Edge<any>

Returns ​

void

Inherited from ​

Stream.unlisten_


when() ​

when(b): Stream<A>

Defined in: index.ts:872

Pass occurrences only while the state is true.

Parameters ​

b ​

State<boolean>

Returns ​

Stream<A>

Inherited from ​

Stream.when