ReactiveStreamSource

type ReactiveStreamSource<T> = object;

Duck-type for objects that build a ReactiveStreamStore on demand via a reactiveStore({ abortSignal }) method. Satisfied by PendingRpcSubscriptionsRequest<T>. Reactive-framework bindings (e.g. React's useSubscription) consume this duck-type so they don't have to name a concrete producer type.

The returned store is in status: 'idle' — the caller is responsible for invoking `connect()` to open the underlying stream.

Example

function bind<T>(source: ReactiveStreamSource<T>, abortSignal: AbortSignal) {
    const store = source.reactiveStore({ abortSignal });
    store.connect();
    return store;
}

See

Type Parameters

Type ParameterDescription
TThe value type emitted by the resulting stream store.

Methods

reactiveStore()

reactiveStore(options): ReactiveStreamStore<T>;

Parameters

ParameterType
options{ abortSignal: AbortSignal; }
options.abortSignalAbortSignal

Returns

ReactiveStreamStore<T>

On this page