OpenSCD-core handling SCL Edits

OpenSCD-Core can edit the current SCL Document by asynchronously listening to CustomEvents. If multiple EditEvents are sent that are depending on each other, it is possible to send a batch of them.
These CustomEvents can be divided into three types:

  • Insert

  • Update

  • Remove

Insert

An Insert EditEvent can be dispatched to insert new Elements into the current Document.


Update

An Update EditEvent can be dispatched to change the Attributes of a provided Element from the current Document.


Remove

a Remove EditEvent can be dispatched to remove an Element from the current Document.


Dispatching multiple events

If multiple EditEvents are sent that are depending on each other, for example to insert an Element with Sub-Elements, it is possible to send a batch of EditEvents. They are handled synchronously: first come, first serve.