|
Joutsen v0.5.0+12-g5dd5f7e
|
A class that represents an event bus which can be used to register to events of other objects or listen to events of other objects without ever holding a reference to them. More...
Public Member Functions | |
| DefaultEventBus () | |
| void | RegisterReceiver< TPayload > (string name, Action< string, TPayload > receiver) |
Registers a System.Action as the listener of the event with name and TPayload. More... | |
| void | RemoveReceiver< TPayload > (string name, Action< string, TPayload > receiver) |
| Removes a listener for an event. More... | |
| void | SendEvent< TPayload > (string name, TPayload payload) |
Fires the event with the given payload. More... | |
| Event< TPayload > | GetEvent< TPayload > (string name) |
Fetches the event with the given name and TPayload from the bus. More... | |
| void | AddEvent< TPayload > (Event< TPayload > newEvent) |
| Adds a new event to the bus for other objects to listen for. More... | |
| Event< TPayload > | AddEvent< TPayload > (String newEventName) |
| Creates a new Framework.System.Events.Event and adds it to the bus. More... | |
| Event< TPayload > | TryAddEvent< TPayload > (Event< TPayload > newEvent) |
| Adds a new event if no event with the same name and type of payload is registered yet. More... | |
| Event< TPayload > | TryAddEvent< TPayload > (String newEventName) |
| Creates and adds a new event if no event with the same name and type of payload is registered yet. More... | |
| bool | RemoveEvent< TPayload > (Event< TPayload > existingEvent) |
| Removes an event from the bus. More... | |
| Event< TPayload > | RemoveEvent< TPayload > (String name) |
| Removes an event from the bus. More... | |
| bool | CanHandleEvent< TPayload > (Event< TPayload > existingEvent) |
| Checks if an event with the same name and payload is registered on the bus. More... | |
| bool | CanHandleEvent< TPayload > (String eventName) |
| Checks if an event with the given name and payload is registered on the bus. More... | |
| void | ClearEvents () |
| Removes all events from the bus. More... | |
Public Member Functions inherited from Joutsen.Events.EventBus | |
| void | RegisterReceiver< TPayload > (String name, Action< string, TPayload > receiver) |
| Removes a listener for an event. More... | |
| void | RemoveReceiver< TPayload > (String name, Action< string, TPayload > receiver) |
| Removes a listener for an event. More... | |
| void | SendEvent< TPayload > (String name, TPayload payload) |
Fires the event with the given payload. More... | |
| Event< TPayload > | GetEvent< TPayload > (String name) |
Fetches the event with the given name and TPayload from the bus. More... | |
| void | AddEvent< TPayload > (Event< TPayload > newEvent) |
| Adds a new event to the bus for other objects listen for. More... | |
| Event< TPayload > | AddEvent< TPayload > (String newEventName) |
| Creates a new Framework.System.Events.Event and adds it to the bus. More... | |
| Event< TPayload > | TryAddEvent< TPayload > (Event< TPayload > newEvent) |
| Adds a new event if no event with the same name and type of payload is registered yet. More... | |
| Event< TPayload > | TryAddEvent< TPayload > (String newEventName) |
| Creates and adds a new event if no event with the same name and type of payload is registered yet. More... | |
| bool | RemoveEvent< TPayload > (Event< TPayload > existingEvent) |
| Removes an event from the bus. More... | |
| Event< TPayload > | RemoveEvent< TPayload > (String name) |
| Removes an event from the bus. More... | |
| bool | CanHandleEvent< TPayload > (Event< TPayload > existingEvent) |
| Checks if an event with the same name and payload is registered on the bus. More... | |
| bool | CanHandleEvent< TPayload > (String eventName) |
| Checks if an event with the given name and payload is registered on the bus. More... | |
A class that represents an event bus which can be used to register to events of other objects or listen to events of other objects without ever holding a reference to them.
| Joutsen.Events.DefaultEventBus.DefaultEventBus | ( | ) |
| void Joutsen.Events.DefaultEventBus.AddEvent< TPayload > | ( | Event< TPayload > | newEvent | ) |
Adds a new event to the bus for other objects to listen for.
| TPayload | the event's payload |
| newEvent | the new event that is added to bus |
| System.ArgumentNullException | if newEvent is null |
| System.ArgumentException | if newEvent is not unique in name and payload |
Implements Joutsen.Events.EventBus.
| Event< TPayload > Joutsen.Events.DefaultEventBus.AddEvent< TPayload > | ( | String | newEventName | ) |
Creates a new Framework.System.Events.Event and adds it to the bus.
| TPayload | the event's payload |
| newEventName | the name of the new event |
| System.ArgumentNullException | if newEvent is null |
| System.ArgumentException | if newEvent is not unique in name and payload |
Implements Joutsen.Events.EventBus.
| bool Joutsen.Events.DefaultEventBus.CanHandleEvent< TPayload > | ( | Event< TPayload > | existingEvent | ) |
Checks if an event with the same name and payload is registered on the bus.
| TPayload | the event's payload |
| existingEvent | the existing event to look for on the bus |
| System.ArgumentNullException | it existingEvent is null |
Implements Joutsen.Events.EventBus.
| bool Joutsen.Events.DefaultEventBus.CanHandleEvent< TPayload > | ( | String | eventName | ) |
Checks if an event with the given name and payload is registered on the bus.
| TPayload | the event's payload |
| eventName | the name of the event |
| System.ArgumentNullException | if eventName is null |
Implements Joutsen.Events.EventBus.
| void Joutsen.Events.DefaultEventBus.ClearEvents | ( | ) |
Removes all events from the bus.
| Event< TPayload > Joutsen.Events.DefaultEventBus.GetEvent< TPayload > | ( | string | name | ) |
Fetches the event with the given name and TPayload from the bus.
| TPayload | the event's payload |
| name | the name of the event |
name and TPayload | System.ArgumentNullException | if name is null |
| System.ArgumentException | if no event with name and TPayload exists |
| void Joutsen.Events.DefaultEventBus.RegisterReceiver< TPayload > | ( | string | name, |
| Action< string, TPayload > | receiver | ||
| ) |
Registers a System.Action as the listener of the event with name and TPayload.
| TPayload | the event's payload |
| name | the name of the event |
| receiver | the System.Action that is registered as the listener of the event |
| System.ArgumentNullException | if name is null |
| bool Joutsen.Events.DefaultEventBus.RemoveEvent< TPayload > | ( | Event< TPayload > | existingEvent | ) |
Removes an event from the bus.
| TPayload | the event's payload |
| existingEvent | the event to remove |
| System.ArgumentNullException | if existingEvent is null |
Implements Joutsen.Events.EventBus.
| Event< TPayload > Joutsen.Events.DefaultEventBus.RemoveEvent< TPayload > | ( | String | name | ) |
Removes an event from the bus.
| TPayload | the event's payload |
| name | the name of the event |
| System.ArgumentNullException | if name is null |
Implements Joutsen.Events.EventBus.
| void Joutsen.Events.DefaultEventBus.RemoveReceiver< TPayload > | ( | string | name, |
| Action< string, TPayload > | receiver | ||
| ) |
Removes a listener for an event.
| TPayload | the event's payload |
| name | the name of the event |
| receiver | the listener that is to be removed |
| void Joutsen.Events.DefaultEventBus.SendEvent< TPayload > | ( | string | name, |
| TPayload | payload | ||
| ) |
Fires the event with the given payload.
| TPayload | the type of the event's payload |
| name | the name of the event |
| payload | the payload of the event |
| Event< TPayload > Joutsen.Events.DefaultEventBus.TryAddEvent< TPayload > | ( | Event< TPayload > | newEvent | ) |
Adds a new event if no event with the same name and type of payload is registered yet.
| TPayload | the type of the event's payload |
| newEvent | the new event |
| System.ArgumentNullException | if newEvent is null |
Implements Joutsen.Events.EventBus.
| Event< TPayload > Joutsen.Events.DefaultEventBus.TryAddEvent< TPayload > | ( | String | newEventName | ) |
Creates and adds a new event if no event with the same name and type of payload is registered yet.
| TPayload | the type of the event's payload |
| newEventName | the name of the event |
| System.ArgumentException | if newEventName is null |
Implements Joutsen.Events.EventBus.