| Package | org.springextensions.actionscript.core.event |
| SVN browsing | EventBus.as |
| Fisheye | EventBus.as |
| Class | public final class EventBus |
EventBus is used as a publish/subscribe event mechanism that lets objects communicate
with eachother in a loosely coupled way.
Objects interested in receiving events can either implement the IEventBusListener interface
and add themselves as listeners for all events on the event bus via the EventBus.addListener() method,
if they are only interested in some events, they can add a specific event handler via the
EventBus.addEventListener() method. The last option is too subscribe to events of a specific Class, use the
EventBus.addEventClassListener() for this purpose.
To dispatch an event, invoke the EventBus.dispatchEvent() or EventBus.dispatch() method.
Documentation reference: the eventbus introduction
| Property | Defined by | ||
|---|---|---|---|
| _classListeners : Dictionary [static] The
Dictionary<Class,Function[]> that holds a mapping between event classes and a list of listener functions | EventBus | ||
| _classProxyListeners : Dictionary [static] The
Dictionary<Class,MethodInvoker[]> that holds a mapping between event classes and a list of listener proxies | EventBus | ||
| _eventListenerProxies : Object [static] A map of event types/names with there corresponding proxied handler functions.
| EventBus | ||
| _eventListeners : Object [static] A map of event types/names with there corresponding handler functions.
| EventBus | ||
| _listeners : ListenerCollection
[static] The IEventBusListener objects that listen to all events on the event bus.
| EventBus | ||
| Method | Defined by | ||
|---|---|---|---|
|
addEventClassListener(eventClass:Class, listener:Function, useWeakReference:Boolean = false):void
[static]
Adds a listener function for events of a specific
Class. | EventBus | ||
|
addEventClassListenerProxy(eventClass:Class, proxy:MethodInvoker, useWeakReference:Boolean = false):void
[static]
Adds a proxied event handler as a listener for events of a specific
Class. | EventBus | ||
|
addEventListener(type:String, listener:Function, useWeakReference:Boolean = false):void
[static]
Adds the given listener function as an event handler to the given event type.
| EventBus | ||
|
addEventListenerProxy(type:String, proxy:MethodInvoker, useWeakReference:Boolean = false):void
[static]
Adds a proxied event handler as a listener to the specified event type.
| EventBus | ||
|
addListener(listener:IEventBusListener, useWeakReference:Boolean = false):void
[static]
Adds the given listener object as a listener to all events send via the event bus.
| EventBus | ||
|
dispatch(type:String):void
[static]
Convenience method for dispatching an event.
| EventBus | ||
|
dispatchEvent(event:Event):void
[static]
Dispatches the specified
Event on the event bus. | EventBus | ||
|
removeAll():void
[static]
Clears the entire
EventBus by removing all types of listeners. | EventBus | ||
|
removeEventClassListener(eventClass:Class, listener:Function):void
[static]
Removes a listener function for events of a specific Class.
| EventBus | ||
|
removeEventClassListenerProxy(eventClass:Class, proxy:MethodInvoker):void
[static]
Removes a proxied event handler as a listener for events of a specific
Class. | EventBus | ||
|
removeEventListener(type:String, listener:Function):void
[static]
Removes the given listener function as an event handler from the given event type.
| EventBus | ||
|
removeEventListenerProxy(type:String, proxy:MethodInvoker):void
[static]
Removes a proxied event handler as a listener from the specified event type.
| EventBus | ||
|
removeListener(listener:IEventBusListener):void
[static]
Removes the given listener from the event bus.
| EventBus | ||
| _classListeners | property |
protected static var _classListeners:Dictionary The Dictionary<Class,Function[]> that holds a mapping between event classes and a list of listener functions
| _classProxyListeners | property |
protected static var _classProxyListeners:Dictionary The Dictionary<Class,MethodInvoker[]> that holds a mapping between event classes and a list of listener proxies
| _eventListenerProxies | property |
protected static var _eventListenerProxies:ObjectA map of event types/names with there corresponding proxied handler functions.
| _eventListeners | property |
protected static var _eventListeners:ObjectA map of event types/names with there corresponding handler functions.
| _listeners | property |
protected static var _listeners:ListenerCollectionThe IEventBusListener objects that listen to all events on the event bus.
| addEventClassListener | () | method |
public static function addEventClassListener(eventClass:Class, listener:Function, useWeakReference:Boolean = false):void
Adds a listener function for events of a specific Class.
eventClass:Class — The specified Class.
|
|
listener:Function — The specified listener function.
|
|
useWeakReference:Boolean (default = false) |
| addEventClassListenerProxy | () | method |
public static function addEventClassListenerProxy(eventClass:Class, proxy:MethodInvoker, useWeakReference:Boolean = false):void
Adds a proxied event handler as a listener for events of a specific Class.
eventClass:Class — The specified Class.
|
|
proxy:MethodInvoker — The specified listener function.
|
|
useWeakReference:Boolean (default = false) |
| addEventListener | () | method |
public static function addEventListener(type:String, listener:Function, useWeakReference:Boolean = false):voidAdds the given listener function as an event handler to the given event type.
Parameterstype:String — the type of event to listen to
|
|
listener:Function — the event handler function
|
|
useWeakReference:Boolean (default = false) |
| addEventListenerProxy | () | method |
public static function addEventListenerProxy(type:String, proxy:MethodInvoker, useWeakReference:Boolean = false):voidAdds a proxied event handler as a listener to the specified event type.
Parameterstype:String — the type of event to listen to
|
|
proxy:MethodInvoker — a proxy method invoker for the event handler
|
|
useWeakReference:Boolean (default = false) |
| addListener | () | method |
public static function addListener(listener:IEventBusListener, useWeakReference:Boolean = false):voidAdds the given listener object as a listener to all events send via the event bus.
Parameterslistener:IEventBusListener |
|
useWeakReference:Boolean (default = false) |
| dispatch | () | method |
public static function dispatch(type:String):voidConvenience method for dispatching an event. This will create an Event instance with the given type and call dispatchEvent() on the event bus.
Parameterstype:String — the type of the event to dispatch
|
| dispatchEvent | () | method |
public static function dispatchEvent(event:Event):void
Dispatches the specified Event on the event bus.
event:Event — The specified Event.
|
| removeAll | () | method |
public static function removeAll():void
Clears the entire EventBus by removing all types of listeners.
| removeEventClassListener | () | method |
public static function removeEventClassListener(eventClass:Class, listener:Function):voidRemoves a listener function for events of a specific Class.
ParameterseventClass:Class — The specified Class.
|
|
listener:Function — The specified listener function.
|
| removeEventClassListenerProxy | () | method |
public static function removeEventClassListenerProxy(eventClass:Class, proxy:MethodInvoker):void
Removes a proxied event handler as a listener for events of a specific Class.
eventClass:Class — The specified Class.
|
|
proxy:MethodInvoker — The specified listener function.
|
| removeEventListener | () | method |
public static function removeEventListener(type:String, listener:Function):voidRemoves the given listener function as an event handler from the given event type.
Parameterstype:String |
|
listener:Function |
| removeEventListenerProxy | () | method |
public static function removeEventListenerProxy(type:String, proxy:MethodInvoker):voidRemoves a proxied event handler as a listener from the specified event type.
Parameterstype:String |
|
proxy:MethodInvoker |
| removeListener | () | method |
public static function removeListener(listener:IEventBusListener):voidRemoves the given listener from the event bus.
Parameterslistener:IEventBusListener |