Is it possible to subscribe to all events in the event bus? The examples I have read show usage for per event subscriptions; is there a example of a catch all? Or a maintained listing of all possible events?
You could override the fire
method of the event bus to log all the events that are being fired.
class EventBusLogger {
constructor(eventBus) {
const fire = eventBus.fire.bind(eventBus);
eventBus.fire = (type, data) => {
console.log(type, data);
fire(type, data);
};
}
}
@StephenOTT Just to understand your request a bit better: Why would you need such a list of events? What would be the use?
Hello, Philipp,
I´ve tried this code. I am able to get all the events, but when I get a shape from the palette into the canvas and try to connect it to any other shape in the diagram, I get this error:
“no shape type specified”
However, this problem does not happen when I add a shape from those that show when you click an element in the diagram.
I did some testing in the sanbox and the same problem happens.
This is the stack trace of the error:
Uncaught Error: no shape type specified
at ElementFactory.createBpmnElement (ElementFactory.js:37)
at ElementFactory.create (ElementFactory.js:29)
at ElementFactory.createConnection (ElementFactory.js:21)
at ConnectionPreview.getConnection (ConnectionPreview.js:76)
at eval (ConnectionPreview.js:28)
at eval (ConnectionPreview.js:106)
at ConnectionPreview.drawPreview (ConnectionPreview.js:32)
at eval (ConnectPreview.js:15)
at invokeFunction (EventBus.js:201)
at EventBus._invokeListener (EventBus.js:126)
at EventBus._invokeListeners (EventBus.js:118)
at EventBus.fire (EventBus.js:93)
at EventBusLogger.eventBus.fire (index.js:27)
at fire (Dragging.js:44)
at HTMLDocument.move (Dragging.js:88)
And finally:
Uncaught ReferenceError: keyEventHandler is not defined
at s.onkeydown (sandbox.8fe7e72a2.js:1)
Is it necessary to handle something else?
Thanks from your answer!