-
Notifications
You must be signed in to change notification settings - Fork 19
DispatchEvent
Fabio Ticconi edited this page Jul 30, 2016
·
6 revisions
Dispatching events is fairly easy. Dispatched events are sent synchronously to all registered event handlers one by one.
eventSystem.dispatch(new MyEvent());
eventSystem.dispatch() will block until all of the events have been called. There currently is no mechanic to avoid loops or stack overflows, so take care!
You can easily dispatch events from systems and managers.
public static class DispatchSystem extends BaseSystem {
EventSystem es;
@Override
protected void processSystem() {
es.dispatch(new MyEvent());
}
}
Customized Dispatching
You can override the dispatching functionality by providing your own EventDispatchStrategy.