Event is a strictly-typed signals and slots implementation, used for core event dispatching.
For example:
var event = new Event<Int->Void> ();
event.add (function (value:Int):Void { trace (value); });
event.dispatch (100);
var event = new Event<Void->Void> ();
event.add (function () { trace ("callback"); });
event.dispatch ();
Constructor
Variables
Methods
add(listener:T, once:Bool = false, priority:Int = 0):Void
Adds a new event listener
Parameters:
listener | A callback that matches the signature of the event |
---|---|
once | Whether to receive an event dispatch only once, or each time it is fired |
priority | The priority for this listener, a higher priority will be dispatched sooner |
has(listener:T):Bool
Checks whether a callback is a listener to this event
Parameters:
listener | A callback that matches the signature of the event |
---|
Returns:
Whether the callback is a listener