RuneHive-Tarnish
Neural OSRS Enhancement Framework
|
Public Member Functions | |
void | subscribe (EventListener listener) |
void | unsubscribe (EventListener listener) |
void | publish (Event event) |
Static Public Member Functions | |
static DataBus | getInstance () |
The difference between a DataBus and publish/subscribe model is that. A DataBus is a form of publish/subscribe, the only difference is that the bus decouples the publisher and subscriber.
This pattern is different from the observer pattern in the sense that the observer pattern only allows for a one-to-many relationship wheres the DataBus allows for a many-to-many relationship.
EventListener
's must subscribe to the bus in order to receive Event
's send by the bus. EventListener
's can then decide which Event
's they are interested in.
Definition at line 62 of file DataBus.java.
|
inlinestatic |
Gets the singleton object.
Definition at line 84 of file DataBus.java.
|
inline |
Sends an Event
to all subscribed listeners.
The listener's will choose which event. they are interested in.
event | The event that will be sent to all listeners. |
Definition at line 124 of file DataBus.java.
|
inline |
Subscribes an EventListener
to this bus.
If a listener is subscribed to this bus, then the listener can choose which Event
's its interested in.
listener | The listener to subscribe to this bus. |
Definition at line 97 of file DataBus.java.
|
inline |
Unsubscribe an EventListener
from this bus.
If a listener is no longer subscribed to this bus then the listener will no longer receive any events sent from the bus.
listener | The listener to unsubscribe from this bus. |
Definition at line 111 of file DataBus.java.