Using the Event API

The Event API exposes a service that can be injected in any Angular component. For more details, please refer to the Event API documentation.

It allows listening to the different events triggered by the Platform services or user interactions. The exposed Event Service is an Event bus where any event is dispatched.

The Platform provides different types of events, which are extensible by extended base class GeneEvent

The following Sample Widget implements an example of Scenario Event handler that shows notifications each time a Scenario Event is received, for example, when the user selects a Scenario.

export class SampleWidgetComponent extends GeneBaseDataWidgetComponent<SampleWidgetConfiguration, SampleWidgetModel> {

    // ...

    /**
     * Overrides base method to handle Scenario Events
     */
    protected onGeneScenarioEvent(event: GeneScenarioEvent) {
        this.toastrService.info('Received Scenario Event !' + event.type);
    }

    // ...
}

The following types of event are available:

  • Application events are events that are triggered when the application state has changed, for example, when application settings have changed. For more details, please refer to Application Events API documentation.

  • Web client events are triggered upon some of user interactions, example: Sidebar shown/hidden, entering or exiting Fullscreen, etc. For more details, please refer to Web Client Events API documentation.

  • Data events are dispatched by the Framework when data are being modified, imported or exported. Application can also trigger REQUEST_EXCEL_IMPORT event to request the provided Excel export mechanism. For more details, please refer to Data Events API documentation.

  • Scenario events are dispatched by the Framework when scenario or Node objects are being modified (Creation, Update, Duplicate, Delete, Lock/Unlock, Permissions Change). For more details, please refer to Scenario Events API documentation.