diff --git a/client/luigi-client.d.ts b/client/luigi-client.d.ts index 890f35362d..f298565918 100644 --- a/client/luigi-client.d.ts +++ b/client/luigi-client.d.ts @@ -259,6 +259,14 @@ export type getToken = () => AuthData['accessToken']; export function getEventData(): Context; export type getEventData = () => Context; +/** + * Returns the context object. It is an alias function for getEventData(). + * @returns {Object} current context data. + * @memberof Lifecycle + */ +export function getContext(): Context; +export type getContext = () => Context; + /** * Returns the node parameters of the active URL. * Node parameters are defined like URL query parameters but with a specific prefix allowing Luigi to pass them to the micro front-end view. The default prefix is **~** and you can use it in the following way: `https://my.luigi.app/home/products?~sort=asc~page=3`. diff --git a/client/src/lifecycleManager.js b/client/src/lifecycleManager.js index 563a859977..d8f54e6ea9 100644 --- a/client/src/lifecycleManager.js +++ b/client/src/lifecycleManager.js @@ -196,6 +196,14 @@ class LifecycleManager extends LuigiClientBase { getEventData() { return this.currentContext.context; } + /** + * Returns the context object. It is an alias function for getEventData(). + * @returns {Object} current context data + * @memberof Lifecycle + */ + getContext() { + return this.getEventData(); + } /** * Returns the node parameters of the active URL. * Node parameters are defined like URL query parameters but with a specific prefix allowing Luigi to pass them to the micro front-end view. The default prefix is **~** and you can use it in the following way: `https://my.luigi.app/home/products?~sort=asc~page=3`. diff --git a/client/src/luigi-client.js b/client/src/luigi-client.js index 9d8633b8cf..91ea790559 100644 --- a/client/src/luigi-client.js +++ b/client/src/luigi-client.js @@ -25,6 +25,9 @@ class LuigiClient { getEventData() { return lifecycleManager.getEventData(); } + getContext() { + return lifecycleManager.getContext(); + } getNodeParams() { return lifecycleManager.getNodeParams(); } diff --git a/core/src/App.html b/core/src/App.html index cda689bf54..983faa0d10 100644 --- a/core/src/App.html +++ b/core/src/App.html @@ -381,7 +381,6 @@ {} ); } - ViewGroupPreloading.viewGroupLoaded(iframe); } diff --git a/docs/luigi-client-api.md b/docs/luigi-client-api.md index 7e8ec15e2e..e5bba636c3 100644 --- a/docs/luigi-client-api.md +++ b/docs/luigi-client-api.md @@ -50,6 +50,12 @@ Returns the context object. Typically it is not required as the [addContextUpdat Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** current context data +### getContext + +Returns the context object. It is an alias function for getEventData(). + +Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** current context data + ### getNodeParams Returns the node parameters of the active URL.