...
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 | ||||||
---|---|---|---|---|---|---|
| ||||||
export default class MyPlugin extends LitElement {
fistUpdated() {
this.getRootNode().addEventListener('oscd-event', () => { ... });
}
} |
Find a (seperate solution) for all problems mentioned.
...