Versions Compared

Key

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

...

Implementing a central event-bus means that current OSCD plugins need some refactoring to dispatch events to the event-bus instead of dispatching events on itself.

The semantic on the central procesbus are determined by the producer/consumer.


We can distinguish different type of events by Producer driven or Consumer driven.

...

Producer driven events can be seen as notification events. The producer is notifying anyone who is interested in this event.


Code changes

Code Block
languagejs
themeConfluence
titleCurrent solution
class MyPlugin extends HTMLElement {
    
    onClick() {
        this.dispatchEvent(new Event('oscd-click'));
    }
}


Code Block
languagejs
themeConfluence
titleEventBus Solution
class MyPlugin extends HTMLElement {

    eventBus: EventBus
    
    onClick() {
        this.eventBus.dispatchEvent(new Event('oscd-click'))
    }
}