How do i remove event listeners from a Bpmn instance

hi, i’m following your examples on adding events to a diagram:

var modelerInstance = new BpmnModeler({
  container: container,
});

importDiagram(modelerInstance, diagram);
modelerInstance.on('element.click', elementClickHandler);`

how can i remove that event listener?

Thanks in advance for your help

Hey @batusai513,

you can do the following:

var eventBus = modelerInstance.get('eventBus');

eventBus.off('element.click', elementClickHandler);

We use the eventBus service for our event communication channel. You can use it directly to attach listeners through .on or .once and then remove them with off.

Cheers,
Ricardo

Hey, thanks for your help, it worked as expected!