Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

    removeEventListener(type: string, callback: EventListenerOrEventListenerObject): void {
        if (this._eventListeners.has(type)) {
            this._eventListeners.set(type, this._eventListeners.get(type)!.filter((cb) =>  cb !== callback));
        }
    }

}
```


Alternatives

Instead of the central EventBus, we can let plugins dispatch events on the plugin itself. If a plugin needs an event from another plugin, It can listen to an event being dispatched to Open-SCD Core .

Example


Code Block
languagejs
themeConfluence
titleListening to Events dispatched to OpenSCD Core
export default class MyPlugin extends LitElement {
    fistUpdated() {
        this.getRootNode().addEventListener('oscd-event', () => { ... });
    }

}



Find a (seperate solution) for all problems mentioned.

...