Rxova
Skip to content

Channel

Type ParameterDefault type
M extends MessageMap-
R extends ReplyMap<M>Record<never, never>
readonly clientId: string;

readonly name: string;
answer<K>(type, responder): () => void;

Answer asks of this type. Returns an unsubscribe.

Type Parameter
K extends string
ParameterType
typeK
responder(payload, meta) => R[K]

() => void


ask<K>(
type,
payload,
options?): Promise<R[K]>;

Ask the origin a question and wait for the first answer.

Rejects if nobody answers before the timeout — an unanswered question is a fact worth having rather than a promise that hangs. If several clients registered an answer for this type, the first reply to arrive wins and the rest are dropped; gate the responder on leadership when you need the answer to come from a particular tab.

Type Parameter
K extends string
ParameterType
typeK
payloadM[K]
options?AskOptions

Promise<R[K]>


close(): void;

void


on<K>(
type,
handler,
options?): () => void;
Type Parameter
K extends string
ParameterType
typeK
handler(payload, meta) => void
options?OnOptions

() => void


post<K>(
type,
payload,
options?): void;

Fire-and-forget to every other tab/window/worker on this origin.

Type Parameter
K extends string
ParameterType
typeK
payloadM[K]
options?PostOptions

void