NotificationEmitter Interface
Interface for a notification emitter that can send typed notification to other clients. \
This API is provided as an alpha preview and may change without notice.
To use, import via @fluidframework/presence/alpha
.
For more information about our API support guarantees, see here.
Sealed
This type is "sealed," meaning that code outside of the library defining it should not implement or extend it. Future versions of this type may add members or make typing of readonly members more specific.
Signature
/** @sealed */
export interface NotificationEmitter<E extends InternalUtilityTypes.NotificationListeners<E>>
Type Parameters
Parameter | Constraint | Description |
---|---|---|
E | InternalUtilityTypes.NotificationListeners<E> |
Methods
Method | Alerts | Return Type | Description |
---|---|---|---|
broadcast(notificationName, args) | Alpha |
void | Emits a notification with the specified name and arguments, notifying all clients. |
unicast(notificationName, targetAttendee, args) | Alpha |
void | Emits a notification with the specified name and arguments, notifying a single attendee. |
Method Details
broadcast
Emits a notification with the specified name and arguments, notifying all clients.
This API is provided as an alpha preview and may change without notice.
For more information about our API support guarantees, see here.
Signature
broadcast<K extends keyof InternalUtilityTypes.NotificationListeners<E>>(notificationName: K, ...args: Parameters<E[K]>): void;
Type Parameters
Parameter | Constraint | Description |
---|---|---|
K | keyof InternalUtilityTypes.NotificationListeners<E> |
Parameters
Parameter | Type | Description |
---|---|---|
notificationName | K | the name of the notification to fire |
args | Parameters<E[K]> | the arguments sent with the notification |
unicast
Emits a notification with the specified name and arguments, notifying a single attendee.
This API is provided as an alpha preview and may change without notice.
For more information about our API support guarantees, see here.
Signature
unicast<K extends keyof InternalUtilityTypes.NotificationListeners<E>>(notificationName: K, targetAttendee: Attendee, ...args: Parameters<E[K]>): void;
Type Parameters
Parameter | Constraint | Description |
---|---|---|
K | keyof InternalUtilityTypes.NotificationListeners<E> |
Parameters
Parameter | Type | Description |
---|---|---|
notificationName | K | the name of the notification to fire |
targetAttendee | Attendee | the single attendee to notify |
args | Parameters<E[K]> | the arguments sent with the notification |