DataPublisher
Represents an object with an on function that you can call to subscribe to certain data over a
named channel.
Example
Type Parameters
| Type Parameter | Default type |
|---|---|
TDataByChannelName extends Record<string, unknown> | Record<string, unknown> |
Methods
on()
Call this to subscribe to data over a named channel.
Type Parameters
Parameters
| Parameter | Type | Description |
|---|---|---|
channelName | TChannelName | The name of the channel on which to subscribe for messages |
subscriber | (data) => void | The function to call when a message becomes available |
options? | { signal: AbortSignal; } | - |
options.signal | AbortSignal | An abort signal you can fire to unsubscribe |
Returns
UnsubscribeFn
A function that you can call to unsubscribe