Interface: UseTabLeaderOptions<TMessage>
Defined in: use-tab-leader.ts:19
Options for useTabLeader.
Type Parameters
TMessage
TMessage = unknown
Properties
enabled?
optionalenabled?:boolean
Defined in: use-tab-leader.ts:24
Takes part in the election only while true. Set it to false to step
down, for example while the user is signed out. Default is true.
onDemoted?
optionalonDemoted?: () =>void
Defined in: use-tab-leader.ts:32
Called when this hook instance stops being the leader: when another
instance takes over, key or enabled changes, or the component
unmounts. Use it to stop the work started in onElected.
Returns
void
onElected?
optionalonElected?: () =>void
Defined in: use-tab-leader.ts:26
Called when this hook instance becomes the leader.
Returns
void
onMessage?
optionalonMessage?: (message,senderId) =>void
Defined in: use-tab-leader.ts:41
Called when another tab (or another hook instance in this tab) calls broadcast. It never receives the hook's own messages.
Parameters
message
TMessage
The value passed to broadcast.
senderId
string
The id of the sender.
Returns
void