The Event configuration option type (BPM 8.5.7 / 8.6) lets a coach view expose named events that the person who places the view on a coach can wire with JavaScript - the way the UI Toolkit controls offer On click, On change, On row selected. Before it existed, a view could only fire its single boundary event or expect callers to monkey-patch functions.
- In the coach view: Configuration > add an option, type Event, name onSelected, description "fires with the selected item". Document in the option's description which variables the handler receives (the toolkit convention is me plus named arguments).
- In the view's code, fire it:
// coach view code (load handler or wherever the event happens)
var _this = this;
this.context.element.querySelector("ul").addEventListener("click", function (e) {
var item = e.target.textContent;
// call the handler text the coach author entered for the option "onSelected"
var handler = _this.context.options.onSelected; // an Event option is exposed as a callable
if (typeof handler === "function") handler({ item: item, me: _this }); // 8.6+: options.<event>(args) runs the coach author's script
});- On the coach: select the view, in the Configuration tab the option shows as a script box: ${Details}.setData(item) - the author writes JavaScript that receives the arguments you passed (and me).
Under the hood the framework compiles the author's text into a function (the same machinery the UI Toolkit uses for eventON_CLICK). Compared with a boundary event: an Event option does not leave the coach, needs no diagram wiring, can pass data, and a view may have many of them; the boundary event is still the way to continue the CSHS flow (service calls, navigation).
References