class Athena::EventDispatcher::EventDispatcher
inherits Reference
#
Default implementation of AED::EventDispatcherInterface.
Included modules
Athena::EventDispatcher::EventDispatcherInterface
Direct known subclasses
Athena::EventDispatcher::Spec::TracableEventDispatcher
Methods#
#dispatch(event : ACTR::EventDispatcher::Event) : ACTR::EventDispatcher::Event#
Dispatches the provided event to all listeners listening on that event.
#has_listeners?(event_class : ACTR::EventDispatcher::Event.class) : Bool#
Returns true if this dispatcher has any listeners on the provided event_class.
#listener(callable : AED::Callable) : AED::Callable#
Registers the provided callable listener to this dispatcher.
#listener(listener : T) : Nil forall T#
Registers the provided listener instance to this dispatcher.
T is any type that has methods annotated with AEDA::AsEventListener.
#listener(callable : AED::Callable, *, priority : Int32) : AED::Callable#
Registers the provided callable listener to this dispatcher, overriding its priority with that of the provided priority.
#listener(event_class : E.class, *, priority : Int32 = 0, name : String | Nil = nil, &block : E, AED::EventDispatcherInterface -> Nil) : AED::Callable forall E#
Registers the block as an AED::Callable on the provided event_class, optionally with the provided priority and/or name.
#listeners(for event_class : ACTR::EventDispatcher::Event.class) : Array(AED::Callable)#
Returns an Array(AED::Callable) for all listeners on the provided event_class.
#listeners : Hash(ACTR::EventDispatcher::Event.class, Array(AED::Callable))#
Returns a hash of all registered listeners as a Hash(ACTR::EventDispatcher::Event.class, Array(AED::Callable)).
#remove_listener(callable : AED::Callable) : Nil#
Deregisters the provided callable from this dispatcher.
Tip
The callable may be one retrieved via either #listeners method.
#remove_listener(listener : T) : Nil forall T#
Deregisters listeners based on the provided listener from this dispatcher.
T is any type that has methods annotated with AEDA::AsEventListener.