Leader
Properties
Section titled “Properties”clientId
Section titled “clientId”readonly clientId: string;strategy
Section titled “strategy”readonly strategy: "heartbeat" | "web-locks";Which mechanism arbitrates this seat — useful in devtools and bug reports.
Methods
Section titled “Methods”close()
Section titled “close()”close(): void;Returns
Section titled “Returns”void
getSnapshot()
Section titled “getSnapshot()”getSnapshot(): LeaderSnapshot;Frozen; a new object only when the leader actually changes.
Returns
Section titled “Returns”resign()
Section titled “resign()”resign(): void;Give up the seat now. Peers take over immediately rather than waiting for the lease.
Returns
Section titled “Returns”void
setEligible()
Section titled “setEligible()”setEligible(eligible): void;Turn candidacy on or off. Eligibility is a property of the tab, not a component.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
eligible | boolean |
Returns
Section titled “Returns”void
subscribe()
Section titled “subscribe()”subscribe(fn): () => void;Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
fn | () => void |
Returns
Section titled “Returns”() => void
waitForLeadership()
Section titled “waitForLeadership()”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.
Returns
Section titled “Returns”Promise<void>