Skip to content

@epikodelabs/streamix


@epikodelabs/streamix / fromPromise

Function: fromPromise()

fromPromise<T>(input): Stream<T>

Defined in: projects/libraries/streamix/src/lib/streams/fromPromise.ts:19

Creates a stream from a cancelable, lazy asynchronous factory.

The factory is invoked on subscription and receives an AbortSignal that is aborted when the stream is unsubscribed. If the factory throws or returns a rejected promise, the stream will emit an error.

Type Parameters

T

T

The type of the emitted value.

Parameters

input

MaybePromise<T> | (signal) => MaybePromise<T>

Returns

Stream<T>

A stream that emits the produced value and then completes.

Released under the MIT License.