EventHandlers

Holds a map of event handlers by their EventType.

Application developers do not need to use this class directly, unless they have a non-Node class which requires event handling, and multiple event handlers can be associated with a single EventType.

There may be multiple handlers for a single EventType, in which case they are handled in the order they were added. If one of them consumes the event, then the process stops (i.e. later handlers do not fire).

Constructors

Link copied to clipboard
constructor()

Functions

Link copied to clipboard
fun <E : Event> add(eventType: EventType<E>, handler: EventHandler<E>, combination: HandlerCombination)

Adds a handler for a specific eventType. If there is already a handler for this event type, then the two are merged into a CompoundEventHandler, and find will return the compound.

Link copied to clipboard
fun <E : Event> find(eventType: EventType<E>): EventHandler<E>?

Returns null if there are no handlers for eventType.

Link copied to clipboard
fun <E : Event> remove(eventType: EventType<E>, handler: EventHandler<E>)

To remove an event handler, you must keep a reference to the handler passed to add. Do NOT use the result from find, because you may remove more than you expect.