public interface NotificationCenter
Object[]
with a notification.
There is a util NotificationTestHelper
that's purpose is to simplify testing of notifications in Unit-Tests.
Modifier and Type | Method and Description |
---|---|
void |
publish(String messageName,
Object... payload)
Post a notification to all NotificationObserver which are registered with the given String.
|
void |
publish(ViewModel viewModel,
String messageName,
Object[] payload)
Publishes a notification to the
ViewModel -subscribers for the given notificationId. |
void |
subscribe(String messageName,
NotificationObserver observer)
Add an observer to the NotificationCenter which gets notifications for the given String.
|
void |
subscribe(ViewModel viewModel,
String messageName,
NotificationObserver observer)
Subscribe to a
ViewModel -notification with a given NotificationObserver . |
void |
unsubscribe(NotificationObserver observer)
Remove all registrations of an NotificationObserver.
|
void |
unsubscribe(String messageName,
NotificationObserver observer)
Removes an observer from the NotificationCenter.
|
void |
unsubscribe(ViewModel viewModel,
NotificationObserver observer)
Removes a
NotificationObserver for all messageName. |
void |
unsubscribe(ViewModel viewModel,
String messageName,
NotificationObserver observer)
Removes a
NotificationObserver for a given messageName. |
void subscribe(String messageName, NotificationObserver observer)
messageName
- key of the notification to listenobserver
- which listens for the notificationvoid unsubscribe(String messageName, NotificationObserver observer)
messageName
- key of the notification to removeobserver
- which listens for the notificationvoid unsubscribe(NotificationObserver observer)
observer
- for remove all notificationsvoid publish(String messageName, Object... payload)
messageName
- of the notification which sould be sendpayload
- which should be passedvoid publish(ViewModel viewModel, String messageName, Object[] payload)
ViewModel
-subscribers for the given notificationId.messageName
- of the notificationpayload
- to be sendvoid subscribe(ViewModel viewModel, String messageName, NotificationObserver observer)
ViewModel
-notification with a given NotificationObserver
.viewModel
- messageName
- of the Notificationobserver
- which should execute when the notification occursvoid unsubscribe(ViewModel viewModel, String messageName, NotificationObserver observer)
NotificationObserver
for a given messageName.viewModel
- messageName
- observer
- void unsubscribe(ViewModel viewModel, NotificationObserver observer)
NotificationObserver
for all messageName.viewModel
- observer
- Copyright © 2015 Saxonia Systems AG. All rights reserved.