IReactNotificationService
Kind: interface
The notification service that can be used to send notifications between different components in an app.
Use the Subscribe
method to subscribe to notifications and the SendNotification
method to send notifications.
Methods
SendNotification
void SendNotification
(IReactPropertyName
notificationName, Object sender, Object data)
Sends the notification with notificationName
.
notificationName
is the name of the notification to send. It must not be null.sender
is the object that sends notification. It can be null.data
is the data associated with the notification. It can be null. Consider usingIReactPropertyBag
for sending semi-structured data. It can be created using theReactPropertyBagHelper.CreatePropertyBag
method.
Subscribe
IReactNotificationSubscription
Subscribe
(IReactPropertyName
notificationName, IReactDispatcher
dispatcher, ReactNotificationHandler
handler)
Subscribes to a notification.
notificationName
is a non-null notification name that can belong to a specific namespace like anyIReactPropertyName
.dispatcher
is used to call notification handlers. If it is null, then the handler is called synchronously.handler
is a delegate that can be implemented as a lambda to handle notifications. The method returns aIReactNotificationSubscription
that must be kept alive while the subscription is active. The subscription is removed when theIReactNotificationSubscription
is destroyed.