Skip to content

module Athena::EventDispatcher::EventDispatcherInterface #

Base type of an event dispatcher. Defines how dispatchers should be implemented.

Direct including types

Athena::EventDispatcher::EventDispatcher

Methods#

abstract #add_listener(event : AED::Event.class, listener : AED::EventListenerType, priority : Int32) : Nil #

Adds the provided listener as a listener for event, optionally with the provided priority.

View source

abstract #dispatch(event : AED::Event) : Nil #

Dispatches event to all listeners registered on self that are listening on that event.

AED::EventListenerInterface's are executed based on the listener's priority; the higher the value the sooner it gets executed.

View source

abstract #has_listeners?(event : AED::Event.class?) : Bool #

Returns true if there are any listeners listening on the provided event. If no event is provided, returns true if there are ANY listeners registered on self.

View source

abstract #listener_priority(event : AED::Event.class, listener : AED::EventListenerInterface.class) : Int32? #

Returns the listener priority for the provided event. Returns nil if no listeners are listening on the provided event or if listener isn't listening on event.

View source

abstract #listeners(event : AED::Event.class?) : Array(AED::EventListener) #

Returns the listeners listening on the provided event. If no event is provided, returns all listeners.

View source

abstract #remove_listener(event : AED::Event.class, listener : AED::EventListenerInterface.class) : Nil #

Removes the provided event from the provided listener.

View source

abstract #remove_listener(event : AED::Event.class, listener : AED::EventListenerType) : Nil #

Removes the provided event from the provided listener.

View source