module Athena::EventDispatcher::EventDispatcherInterface
Overview
Base type of an event dispatcher. Defines how dispatchers should be implemented.
Direct including types
Defined in:
event_dispatcher_interface.crInstance Method Summary
-
#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.
-
#dispatch(event : AED::Event) : Nil
Dispatches event to all listeners registered on
self
that are listening on that event. -
#has_listeners?(event : AED::Event.class | Nil) : Bool
Returns
true
if there are any listeners listening on the provided event. -
#listener_priority(event : AED::Event.class, listener : AED::EventListenerInterface.class) : Int32 | Nil
Returns the listener priority for the provided event.
-
#listeners(event : AED::Event.class | Nil) : Array(AED::EventListener)
Returns the listeners listening on the provided event.
-
#remove_listener(event : AED::Event.class, listener : AED::EventListenerInterface.class) : Nil
Removes the provided event from the provided listener.
-
#remove_listener(event : AED::Event.class, listener : AED::EventListenerType) : Nil
Removes the provided event from the provided listener.
Instance Method Detail
Adds the provided listener as a listener for event, optionally with the provided priority.
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.
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
.
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.
Returns the listeners listening on the provided event. If no event is provided, returns all listeners.
Removes the provided event from the provided listener.
Removes the provided event from the provided listener.