Versions Compared

Key

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

...

Info

Example use-case

An end-user selects 2 IED's in 1 plug-in. In order to make a connection between IED's, the user want to open the selection in an another plug.


Also, since Addons addons are not extending from a HTMLElement, Addons addons cannot subscribe to events on themselves.

HTML Events events are only going up upwards in the DOMTree, not down downwards and/or to siblings.

Decision


If we want plugins plug-ins for OpenSCD to be asynchronous accessible to each other, OpenSCD-Core should make use of a central event-bus.
Instead of dispatching an event on the plugin plug-in itself, the plugin plug-in can dispatch an event on the central event-bus. This will take care of the current problems we're facing:


Addons 

Addons can listen to CustomEvents being caught by the OpenSCD HTML Element. This will solve the communication problem from a plug-in or addon to a different addon.

Plug-ins communicating between themselves are not solved by this solution.



```ts
export  class EventBus implements EventTarget {

...