Skip to content

@epikodelabs/streamix


@epikodelabs/streamix / src/public-api / createPushOperator

Function: createPushOperator()

createPushOperator<T, R>(name, setup): Operator<T, R>

Defined in: projects/libraries/streamix/src/lib/atoms/operator.ts:188

Creates a push operator where setup receives the source iterator and a pre-created output pushable. setup may return an optional cleanup callback that is invoked when the downstream cancels iteration (return() / throw()).

The setup function is guarded by a cancellation gate: once the operator is cancelled (via return() or throw() on the output), any further pushes to the output are silently ignored. This prevents pushes to a completed/closed output after teardown.

Type Parameters

T

T

The type of values consumed by the operator.

R

R = T

The type of values produced by the operator.

Parameters

name

string

The name of the operator, for debugging.

setup

(source, output) => void | () => MaybePromise<void>

A function that receives the source iterator and an output pushable. May return a cleanup function to be called on cancellation.

Returns

Operator<T, R>

Released under the GNU AGPL v3 or later.