@luigi-project/container
Version:
Javascript library enabling creation of microfrontends
160 lines (158 loc) • 6.19 kB
JavaScript
/* eslint-disable @typescript-eslint/no-unsafe-function-type */
var Events;
(function (Events) {
/**
* Event fired when the micro frontend sends a custom message.
*/
Events.CUSTOM_MESSAGE = 'custom-message';
/**
* Event fired when the micro frontend requests the context data.
*/
Events.GET_CONTEXT_REQUEST = 'get-context-request';
/**
* Event fired when a navigation has been requested by the micro frontend.
*/
Events.NAVIGATION_REQUEST = 'navigation-request';
/**
* Event fired when the micro frontend requests to show an alert.
*/
Events.ALERT_REQUEST = 'show-alert-request';
/**
* Event left due to historical reasons - do not use.
* @deprecated
*/
Events.ALERT_CLOSED = 'close-alert-request';
/**
* Event fired when the micro frontend has been initialized.
*/
Events.INITIALIZED = 'initialized';
/**
* Event fired when the micro frontend requests the addition of search parameters to the URL.
*/
Events.ADD_SEARCH_PARAMS_REQUEST = 'add-search-params-request';
/**
* Event fired when the micro frontend requests the addition of node parameters to the URL.
*/
Events.ADD_NODE_PARAMS_REQUEST = 'add-node-params-request';
/**
* Event fired when the micro frontend requests to show a confirmation modal.
*/
Events.SHOW_CONFIRMATION_MODAL_REQUEST = 'show-confirmation-modal-request';
/**
* Event fired when the micro frontend requests to show a loading indicator.
*/
Events.SHOW_LOADING_INDICATOR_REQUEST = 'show-loading-indicator-request';
/**
* Event fired when the micro frontend requests to hide the loading indicator.
*/
Events.HIDE_LOADING_INDICATOR_REQUEST = 'hide-loading-indicator-request';
/**
* Event fired when the micro frontend requests to set the current locale.
*/
Events.SET_CURRENT_LOCALE_REQUEST = 'set-current-locale-request';
/**
* Event fired when the micro frontend requests to modify the local storage.
*/
Events.LOCAL_STORAGE_SET_REQUEST = 'set-storage-request';
/**
* Event fired when the micro frontend requests to handle errors that might happen during the runtime of the micro frontend.
*/
Events.RUNTIME_ERROR_HANDLING_REQUEST = 'runtime-error-handling-request';
/**
* Event fired when the micro frontend requests to set the anchor of the URL.
*/
Events.SET_ANCHOR_LINK_REQUEST = 'set-anchor-request';
/**
* Event fired when the micro frontend requests to set third-party cookies.
*/
Events.SET_THIRD_PARTY_COOKIES_REQUEST = 'set-third-party-cookies-request';
/**
* Event fired when the micro frontend requests to navigate back.
* @deprecated use GO_BACK_REQUEST
*/
Events.BACK_NAVIGATION_REQUEST = 'navigate-back-request';
/**
* Event fired when the micro frontend requests the current app route.
*/
Events.GET_CURRENT_ROUTE_REQUEST = 'get-current-route-request';
/**
* Event fired to report that the micro frontend's navigation has completed.
*/
Events.NAVIGATION_COMPLETED_REPORT = 'report-navigation-completed-request';
/**
* Event fired when the micro frontend requests to update the modal path parameters.
*/
Events.UPDATE_MODAL_PATH_DATA_REQUEST = 'update-modal-path-data-request';
/**
* Event fired when the micro frontend requests to update the modal settings.
*/
Events.UPDATE_MODAL_SETTINGS_REQUEST = 'update-modal-settings-request';
/**
* Event fired when the micro frontend requests to check the validity of a path.
*/
Events.CHECK_PATH_EXISTS_REQUEST = 'check-path-exists-request';
/**
* Event fired when the micro frontend requests to set the 'dirty status' which, for example, avoids closing when there are any unsaved changes.
*/
Events.SET_DIRTY_STATUS_REQUEST = 'set-dirty-status-request';
/**
* Event fired when the micro frontend requests to set the view group data.
*/
Events.SET_VIEW_GROUP_DATA_REQUEST = 'set-viewgroup-data-request';
/**
* Event fired when the micro frontend requests to set the document title.
* @deprecated
*/
Events.SET_DOCUMENT_TITLE_REQUEST = 'set-document-title-request';
/**
* Event fired when the micro frontend requests to open the user settings.
*/
Events.OPEN_USER_SETTINGS_REQUEST = 'open-user-settings-request';
/**
* Event fired when the micro frontend requests to close the user settings.
*/
Events.CLOSE_USER_SETTINGS_REQUEST = 'close-user-settings-request';
/**
* Event fired when the micro frontend requests to collapse left side navigation.
*/
Events.COLLAPSE_LEFT_NAV_REQUEST = 'collapse-leftnav-request';
/**
* Event fired when the micro frontend requests to update the top navigation.
*/
Events.UPDATE_TOP_NAVIGATION_REQUEST = 'update-top-navigation-request';
/**
* Event fired when the micro frontend requests to check if the path exists.
* @deprecated use CHECK_PATH_EXISTS_REQUEST
*/
Events.PATH_EXISTS_REQUEST = 'path-exists-request';
/**
* Event fired when the micro frontend requests to navigate back.
*/
Events.GO_BACK_REQUEST = 'go-back-request';
/**
* Event fired when the micro frontend requests to check if there are any preserved views.
*/
Events.HAS_BACK_REQUEST = 'has-back-request';
/**
* Event fired when the micro frontend requests to display the backdrop.
*/
Events.ADD_BACKDROP_REQUEST = 'add-backdrop-request';
/**
* Event fired when the micro frontend requests to remove the backdrop.
*/
Events.REMOVE_BACKDROP_REQUEST = 'remove-backdrop-request';
})(Events || (Events = {}));
class LuigiEvent extends Event {
constructor(type, data, payload, callback) {
super(type);
this.detail = data;
this.payload = payload || data || {};
this.callbackFn = callback;
}
callback(data) {
if (this.callbackFn) {
this.callbackFn(data);
}
}
}
export { LuigiEvent, Events as LuigiEvents };