The Dispatcher type manages events and their listeners.

Static methods

staticinlineaddEvent(this:Map<String, Event>, eventName:String):Bool

Adds an event to the dispatcher.

Parameters:

eventName

A name of the event.

Returns:

true if the event was successfully added, false otherwise.

staticinlineaddEventListener(this:Map<String, Event>, eventName:String, listener:EventListener):Bool

Adds an event listener to the dispatcher.

Parameters:

eventName

A name of the event.

listener

The function to be executed.

Returns:

true if the listener was successfully added, false otherwise.

staticinlineemitEvent(this:Map<String, Event>, eventName:String, ?data:Dynamic):Bool

Emits an event.

Parameters:

eventName

A name of the event.

Returns:

true if the event was successfully emitted, false otherwise.

@:op(a.b)staticinlinegetEvent(this:Map<String, Event>, eventName:String):Event

Gets an event from the dispatcher.

Parameters:

eventName

A name of the event.

Returns:

the event.

staticinlinehasEvent(this:Map<String, Event>, eventName:String):Bool

Checks whether the dispatcher has an event.

Parameters:

eventName

A name of the event.

Returns:

true if the dispatcher has an event, false otherwise.

staticinlineremoveEvent(this:Map<String, Event>, eventName:String):Bool

Removes an event from the dispatcher.

Parameters:

eventName

A name of the event.

Returns:

true if the event was successfully removed, false otherwise.

staticinlineremoveListener(this:Map<String, Event>, eventName:String, listener:EventListener):Bool

Removes an event listener from the dispatcher.

Parameters:

eventName

A name of the event.

listener

The listener to remove.

Returns:

true if the listener was successfully removed, false otherwise.

@:op(a.b)staticinlinesetEvent(this:Map<String, Event>, eventName:String, event:Event):Void

Sets an event from the dispatcher.

Parameters:

eventName

A name of the event.

event

The event.