Capevace / mission-control

Open-Source JavaScript framework for building real-time dashboards
https://mission-control.js.org
MIT License
10 stars 2 forks source link

Add Hooks API so plugins can react to other service's actions etc. #37

Open Capevace opened 3 years ago

Capevace commented 3 years ago

Use a async hook system that an unlimited amount of plugins can subscribe to, that are decoupled from for example service state and action.

hooks
    .service('notifications')
    .onAction('create')
    .run(() => {
        // Do something
    });

hooks
    .service('notifications')
    .onSettingsChange('thing');

hooks
    .service('notifications')
    .trigger('create', notification);