Interface: EventEngine\<TPresence\>
@roomful/core / EventEngine
Interface: EventEngine<TPresence>
Section titled “Interface: EventEngine<TPresence>”Defined in: packages/core/src/types.ts:1193
Exposes custom event operations for a room.
Type Parameters
Section titled “Type Parameters”TPresence
Section titled “TPresence”TPresence extends PresenceData = PresenceData
The custom peer presence shape.
Methods
Section titled “Methods”emit()
Section titled “emit()”emit<
TPayload>(name,payload):void
Defined in: packages/core/src/types.ts:1202
Broadcasts a custom event to the room.
Type Parameters
Section titled “Type Parameters”TPayload
Section titled “TPayload”TPayload = unknown
The payload type for this event call.
Parameters
Section titled “Parameters”string
The event channel name.
payload
Section titled “payload”TPayload
The payload to send.
Returns
Section titled “Returns”void
Nothing.
emitTo()
Section titled “emitTo()”emitTo<
TPayload>(peerId,name,payload):void
Defined in: packages/core/src/types.ts:1213
Sends a custom event to a specific peer.
Type Parameters
Section titled “Type Parameters”TPayload
Section titled “TPayload”TPayload = unknown
The payload type for this event call.
Parameters
Section titled “Parameters”peerId
Section titled “peerId”string
The target peer identifier.
string
The event channel name.
payload
Section titled “payload”TPayload
The payload to send.
Returns
Section titled “Returns”void
Nothing.
off<
TPayload>(name,cb):void
Defined in: packages/core/src/types.ts:1236
Removes a custom event listener.
Type Parameters
Section titled “Type Parameters”TPayload
Section titled “TPayload”TPayload = unknown
The payload type expected from this channel.
Parameters
Section titled “Parameters”string
The event channel name.
(payload, from) => void
The callback to remove.
Returns
Section titled “Returns”void
Nothing.
on<
TPayload>(name,cb):Unsubscribe
Defined in: packages/core/src/types.ts:1223
Subscribes to a custom event channel.
Type Parameters
Section titled “Type Parameters”TPayload
Section titled “TPayload”TPayload = unknown
The payload type expected from this channel.
Parameters
Section titled “Parameters”string
The event channel name.
(payload, from) => void
The callback invoked with the payload and sending peer.
Returns
Section titled “Returns”A function that removes the listener.