Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update descriptor-for-applications-components-and-libraries-manifest-json-be0cf40.md #112

Merged
merged 1 commit into from
Mar 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2885,33 +2885,32 @@ For the following namespaces, the indicated teams are responsible:
The component declares the existence of the application descriptor by specifying `manifest: "json"` in the component metadata. Setting this flag makes the component load the `manifest.json` file and read the relevant entries for SAPUI5. This metadata is used to define the dependencies that need to be loaded in order to start the component. The following code snippet shows how to add the manifest link:

```js
sap.ui.define(['sap/ui/core/UIComponent'], function(UIComponent) {

return UIComponent.extend("sap.samples.Component", {
metadata : {
manifest: "json"
sap.ui.define([
"sap/ui/core/UIComponent"
], (UIComponent) => {
"use strict";
return UIComponent.extend("my.sample.Component", {
metadata: {
manifest: "json",
interfaces: [
"sap.ui.core.IAsyncContentCreation"
]
}
});

});
```



## SAPUI5 API

At runtime, the `manifest.json` content can be accessed from the component via the component metadata:
At runtime, the manifest content can be accessed from the component via the following `sap.ui.core.Component` APIs:

```js
// get the component class
sap.ui.require(['sap/samples/Component'], function(SampleComponent) {

// getting complete manifest from component metadata
SampleComponent.getMetadata().getManifest();
//or getting a namespace
SampleComponent.getMetadata().getManifestEntry("sap.app");

});
// Given: oComponent === instance of sap.ui.core.Component (e.g. returned by sap.ui.core.mvc.Controller#getOwnerComponent).
oComponent.getManifest(); // returns: reference to the entire manifest object if it exists. Otherwise, null.
oComponent.getManifestEntry("sap.app"); // returns: reference to the configuration section of the manifest.
oComponent.getManifestEntry("/sap.ui5/dependencies/libs"); // returns: reference or value of the manifest configuration by path, of which the syntax must start with a slash.
```

[sap.ui.core.UIComponent](https://ui5.sap.com/#/api/sap.ui.core.UIComponent)
Expand Down
Loading