Rxova
Skip to content

Leader

readonly clientId: string;

readonly strategy: "heartbeat" | "web-locks";

Which mechanism arbitrates this seat — useful in devtools and bug reports.

close(): void;

void


getSnapshot(): LeaderSnapshot;

Frozen; a new object only when the leader actually changes.

LeaderSnapshot


resign(): void;

Give up the seat now. Peers take over immediately rather than waiting for the lease.

void


setEligible(eligible): void;

Turn candidacy on or off. Eligibility is a property of the tab, not a component.

ParameterType
eligibleboolean

void


subscribe(fn): () => void;
ParameterType
fn() => void

() => void


waitForLeadership(): Promise<void>;

Resolves the moment this client holds the seat, or immediately if it already does. Rejects if the leader is closed while still waiting — so an await in a torn-down tab does not hang forever.

Promise<void>