ReactiveStreamSource

type ReactiveStreamSource<T> = object;

Duck-type for objects that build a ReactiveStreamStore on demand via a reactiveStore() 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. Attach a caller-provided cancellation source via `withSignal()`store.withSignal(signal).connect().

Example

function bindWithTimeout<T>(source: ReactiveStreamSource<T>) {
    const store = source.reactiveStore();
    store.withSignal(AbortSignal.timeout(30_000)).connect();
    return store;
}

See

Type Parameters

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

Methods

reactiveStore()

reactiveStore(): ReactiveStreamStore<T>;

Returns

ReactiveStreamStore<T>

On this page