Class StaticBus<T>
This is the simplest an fastest implementation for the event bus pattern. Since this is static bus DO NOT USE it when you making a package, Since it may conflict with user project.
It only make sense to use it inside the project you maintain and own.
Inheritance
System.Object
StaticBus<T>
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ToString()
System.Object.ReferenceEquals(System.Object, System.Object)
Namespace: StansAssets.Foundation.Patterns
Assembly: cs.temp.dll.dll
Syntax
public static class StaticBus<T>
where T : IEvent
Type Parameters
Name | Description |
---|---|
T | Event Type. |
Methods
Post(T)
Posts and event.
Declaration
public static void Post(T event)
Parameters
Type | Name | Description |
---|---|---|
T | event | An event instance to post. |
Subscribe(Action<T>)
Subscribes listener to a certain event type.
Declaration
public static void Subscribe(Action<T> listener)
Parameters
Type | Name | Description |
---|---|---|
System.Action<T> | listener | Listener instance. |
Unsubscribe(Action<T>)
Unsubscribes listener to a certain event type.
Declaration
public static void Unsubscribe(Action<T> listener)
Parameters
Type | Name | Description |
---|---|---|
System.Action<T> | listener | Listener instance. |