Events
Every fundamental ActiveJS construct has a number of built-in Observable events. You can listen to these events by subscribing to the events$ Observable, a property of every fundamental construct.
​Units, Systems, Action, and Cluster have a common EventReplay event, it is triggered on a successful manual replay when you call the replay() method.
​Units have many Units specific events that let you tap into all the action that's happening on a Unit. Every Unit has some common events like EventUnitDispatch, EventUnitDispatchFail andEventUnitFreeze etc.
​ListUnit and DictUnit have even more events specific to them, like EventDictUnitSet, EventListUnitPush or EventListUnitPop etc.
See API reference for more details.

Listening to events

1
const theAction = new Action(); // can also be a Unit, System or Cluster
2
​
3
theAction.events$.subscribe(event => {
4
// Action, AsyncSystem and Cluster only have one event
5
// so filtering is optional
6
if(event instanceof EventReplay) {
7
console.log('hey, you got replayed');
8
}
9
});
10
​
11
// dispatch a value
12
theAction.dispatch('order order');
13
// this won't trigger any event, only Units emit an event on dispatch
14
​
15
// replay the value
16
theAction.replay(); // it'll trigger the EventReplay event
Copied!
Last modified 1yr ago
Copy link