ReactiveActionSource

type ReactiveActionSource<T> = object;

Duck-type for objects that build a ReactiveActionStore on demand via reactiveStore(). Satisfied by PendingRpcRequest<T>. The [] argument tuple is intentional — the operation's arguments are already baked into the pending request, so each dispatch() re-fires the same call.

The optional perRequestSignal factory is invoked on every dispatch to provide a fresh signal for that attempt. Combined with the store's internal per-dispatch controller via AbortSignal.any, so aborting either cancels the in-flight call.

  • For "kill the store permanently": return the same cancellable signal on every call (() => killCtrl.signal); aborting killCtrl makes every future dispatch start with an already-aborted signal.
  • For "per-attempt timeout": return a fresh AbortSignal.timeout(N) each call; each dispatch gets its own clock.

Example

function bind<T>(source: ReactiveActionSource<T>) {
    return source.reactiveStore({ perRequestSignal: () => AbortSignal.timeout(30_000) });
}

See

Type Parameters

Type ParameterDescription
TThe value type resolved by the wrapped operation.

Methods

reactiveStore()

reactiveStore(options?): ReactiveActionStore<[], T>;

Parameters

ParameterType
options?{ perRequestSignal?: () => | AbortSignal | undefined; }
options.perRequestSignal?() => | AbortSignal | undefined

Returns

ReactiveActionStore<[], T>

On this page