@continuum-js/frp / StreamSource
Interface: StreamSource<A>
Defined in: index.ts:1426
A source stream: occurrences enter the network via .fire.
Extends
Stream<A>
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
onWake
onWake: (() =>
void) |null=null
Defined in: index.ts:445
Internal
Reseed hook run on wake, before inputs attach (lift caches).
Inherited from
rank
rank:
number
Defined in: index.ts:412
Internal
Topological height in the graph (propagation order).
Inherited from
Accessors
disposed
Get Signature
get disposed():
boolean
Defined in: index.ts:452
True once dispose() has run.
Returns
boolean
Inherited from
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
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
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
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
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
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
filter()
filter(
pred):Stream<A>
Defined in: index.ts:742
Parameters
pred
(a) => boolean
Returns
Stream<A>
Inherited from
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
listen()
listen(
h):Unlisten
Defined in: index.ts:929
Observer (phase post): fires after the moment closes, FIFO.
Parameters
h
(a) => void
Returns
Inherited from
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
Inherited from
map()
map<
B>(f):Stream<B>
Defined in: index.ts:732
Type Parameters
B
B
Parameters
f
(a) => B
Returns
Stream<B>
Inherited from
mapTo()
mapTo<
B>(b):Stream<B>
Defined in: index.ts:738
Type Parameters
B
B
Parameters
b
B
Returns
Stream<B>
Inherited from
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
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
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
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
send_()
send_(
t,a):void
Defined in: index.ts:594
Internal
Push an occurrence to every current subscriber.
Parameters
t
a
A
Returns
void
Inherited from
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
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
Inherited from
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
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>