NotificationSubscribable Interface
An object which allows the registration of listeners so that subscribers can be notified when a notification happens.
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.
Signature
/** @sealed */
export interface NotificationSubscribable<E extends InternalUtilityTypes.NotificationEvents<E>>
Type Parameters
Parameter | Constraint | Description |
---|---|---|
E | InternalUtilityTypes.NotificationEvents<E> |
Methods
Method | Alerts | Return Type | Description |
---|---|---|---|
on(notificationName, listener) | Alpha |
() => void | Register a notification listener. |
Method Details
on
Register a notification listener.
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.
Signature
on<K extends keyof InternalUtilityTypes.NotificationEvents<E>>(notificationName: K, listener: (sender: ISessionClient, ...args: InternalUtilityTypes.JsonDeserializedParameters<E[K]>) => void): () => void;
Type Parameters
Parameter | Constraint | Description |
---|---|---|
K | keyof InternalUtilityTypes.NotificationEvents<E> |
Parameters
Parameter | Type | Description |
---|---|---|
notificationName | K | the name of the notification |
listener | (sender: ISessionClient, ...args: InternalUtilityTypes.JsonDeserializedParameters<E[K]>) => void | the handler to run when the notification is received from other client |
Returns
a function which will deregister the listener when run. This function has undefined behavior if called more than once.
Return type: () => void