CallHandle<TReply, TProgress>
interfaceextends 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
| Name | Type | Description |
|---|---|---|
TReply | – | The terminal reply event. |
TProgress | – | Non-terminal correlated events. |
Properties
| Name | Type | Description |
|---|---|---|
dropped | number | Progress events discarded because nothing was iterating. |
Methods
cancel
Stops listening and settles the call. Safe to call more than once.