Skip to content

Commit

Permalink
alias fn for getEventData (SAP#639)
Browse files Browse the repository at this point in the history
  • Loading branch information
JohannesDoberer authored Jul 12, 2019
1 parent 05e4f17 commit 65b98ce
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 1 deletion.
8 changes: 8 additions & 0 deletions client/luigi-client.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
Expand Down
8 changes: 8 additions & 0 deletions client/src/lifecycleManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
Expand Down
3 changes: 3 additions & 0 deletions client/src/luigi-client.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ class LuigiClient {
getEventData() {
return lifecycleManager.getEventData();
}
getContext() {
return lifecycleManager.getContext();
}
getNodeParams() {
return lifecycleManager.getNodeParams();
}
Expand Down
1 change: 0 additions & 1 deletion core/src/App.html
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,6 @@
{}
);
}

ViewGroupPreloading.viewGroupLoaded(iframe);
}

Expand Down
6 changes: 6 additions & 0 deletions docs/luigi-client-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 65b98ce

Please sign in to comment.