Interface adways.event.IEventDispatcherR
IEventDispatcherR interface description
addEventListener( kind, callback, [instance=null], [priority=0], [useWeakReference=false] )
public
Adds an event listener of a specific event kind.
Parameters:
-
kind<Constant>kind of the event to listen
-
callback<FUNCTION>function called when the event is fired
-
[instance=null]<Object> optionalcallback's instance. Useful when the callback is binded to an object:
Class = function () {}; Class.prototype.callback = function () {}; var a = new Class(); aDispatcher.addEventListener(AN_EVENT_KIND, a.callback, a); -
[priority=0]<Number> optionalpriority
-
[useWeakReference=false]<Boolean> optionalnot yet used
1 if event added, 0 otherwise (already added callback).
When instance==null, the callback should be accessible from the global context and be a "static" method. Exemple:
namespaceA.subnamespace.myCallback = function (event) {
...
};
aDispatcher.addEventListener(AN_EVENT_KIND, namespaceA.subnamespace.myCallback);
hasEventListener( kind, callback, [instance=null] )
public
Whether or not a listener has already been added.
Parameters:
-
kind<Constant>the event's kind
-
callback<FUNCTION>the listener's function
-
[instance=null]<Object> optionalthe listener callback's instance
the listeners count.
nbEventListeners( kind )
public
Counts the listeners added for a specific event.
Parameters:
-
kind<Constant>the event's kind
the listeners count.
removeAllEventListeners( )
public
Removes all the listeners.
1 on success (currently always), 0 otherwise.
removeEventListener( kind, callback, [instance=null] )
public
Removes an event listener of a specific event kind.
Parameters:
-
kind<Constant>kind of the event to listen
-
callback<FUNCTION>function called when the event is fired
-
[instance=null]<Object> optionalcallback's instance
1 if event removed, 0 otherwise ( couple < instance + callback > not found).