Skip to content

@epikodelabs/streamix


@epikodelabs/streamix / delayUntil

Function: delayUntil()

delayUntil<T, R>(notifier): Operator<T, T>

Defined in: projects/libraries/streamix/src/lib/operators/delayUntil.ts:41

Delay values from the source until a notifier emits.

This operator buffers every value produced by the source stream and releases them only after the provided notifier produces its first emission. After the notifier emits, the operator flushes the buffered values and forwards all subsequent source values immediately.

Important semantics:

  • Buffering: values are buffered until the notifier emits, then flushed in order
  • Notifier completion without emission: if the notifier completes without emitting, buffered values are discarded and the operator will not forward any buffered values (it simply waits for the source to continue/complete).
  • Error propagation: any error from the notifier or source is propagated to the output (the operator records the error and terminates the output iterator accordingly).

Use-cases:

  • Delay producing values until an initialization step completes (e.g. wait for a connection or configuration event).
  • Gate values until user interaction or external readiness signal occurs.

Type Parameters

T

T = any

Source/output value type.

R

R = any

Notifier value type (ignored by this operator).

Parameters

notifier

A Stream<R> or Promise<R> that gates the source.

Stream<R> | Promise<R>

Returns

Operator<T, T>

An Operator<T, T> that can be used in a stream pipeline.

Released under the MIT License.