Function: useEvent()
@roomful/react / useEvent
Function: useEvent()
Section titled “Function: useEvent()”useEvent<
TPayload,TPresence>(name,handler): (payload) =>void
Defined in: react/src/index.ts:538
Subscribes to a custom event channel and returns an emitter for that channel.
Type Parameters
Section titled “Type Parameters”TPayload
Section titled “TPayload”TPayload = unknown
The payload type for the channel.
TPresence
Section titled “TPresence”TPresence extends PresenceData = PresenceData
The room presence shape.
Parameters
Section titled “Parameters”string
The custom event channel name.
handler
Section titled “handler”(payload, from) => void
The callback invoked for incoming events.
Returns
Section titled “Returns”A function that emits payloads on the same channel.
(
payload):void
Parameters
Section titled “Parameters”payload
Section titled “payload”TPayload
Returns
Section titled “Returns”void