mixinafReflux::EventHub
afReflux::EventHub
@
Js
(Service) - An eventing strategy for Reflux Apps.
To receive events, classes must first register themselves with EventHub
. Given MyEvents
is an event mixin:
class MyService : MyEvents { new make(EventHub eventHub) { eventHub.register(this) } override Void onEvent() { ... } }
Note that instances of Panels
, Views
and GlobalCommands
are already automatically added to EventHub
by default.
- deregister
- fireEvent
abstract Void fireEvent(Method method, Obj?[]? args := null)
Fires an event. There should be very little need to call this directly. Just
@Inject
the service and call the event method instead!- fireEventIn
abstract Void fireEventIn(Duration delay, Method method, Obj?[]? args := null)
Fires an event after the given delay.
- register
abstract Void register(Obj eventSink, Bool checked := true)
Registers an object to receive events. The object must implement one or more contributed event types else an
ArgErr
is thrown.