Skip to content

@epikodelabs/streamix


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

Function: createSharedSource()

createSharedSource<T>(connect, options?): Atom<T>

Defined in: projects/libraries/streamix/src/lib/utils/sharedSource.ts:32

Creates a hot, shared source atom.

The underlying producer is started on the first subscription and stopped when the last subscriber leaves. The stream owns a single cyclic buffer: one buffer, one reader. Values read from the buffer are distributed to callback subscribers and/or the single active async iterator.

Type Parameters

T

T

Parameters

connect

(push) => MaybePromise<() => MaybePromise<void>>

options?

SharedSourceOptions = {}

Returns

Atom<T>

Released under the GNU AGPL v3 or later.