CallHandle<TReply, TProgress>

interface
store/call.ts:191

extends Promise<TReply>, AsyncIterable<TProgress>

The result of StoreInstance.call: awaitable for the terminal reply, async-iterable for progress.

One object serving both shapes, rather than two functions, because the caller's intent is not known at the call site, the same request may be awaited in one place and streamed in another, and the responder should not have to care which. ts // Await the answer, ignore the running commentary. const done = await store.call("rpc", "ask", { q }, { reply: ["rpc", "answer"] }); // Or consume the commentary, then take the answer. const call = store.call("rpc", "ask", { q }, { reply: ["rpc", "answer"] }); for await (const step of call) render(step.payload); const answer = await call; Awaiting the same call twice is safe and yields the same reply; the terminal event is retained.

Type parameters

NameTypeDescription
TReply–The terminal reply event.
TProgress–Non-terminal correlated events.

Properties

NameTypeDescription
droppednumberProgress events discarded because nothing was iterating.

Methods

cancel

Stops listening and settles the call. Safe to call more than once.

signature
cancel(reason?): void

Stops listening and settles the call. Safe to call more than once.

Parameters

NameTypeDescription
reason?string

Returns

void