Skip to content

Commit

Permalink
OpenUI5 Documentation Update 28.05.2024
Browse files Browse the repository at this point in the history
  • Loading branch information
openui5bot committed May 28, 2024
1 parent 1b07d42 commit 4acc1e8
Showing 1 changed file with 6 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,16 +72,14 @@ sap.ui.define(['sap/ui/core/Lib'], function(Library) {
```

> ### Note:
> In all cases, the lazy libraries need to be loaded manually in the application or library via the `sap/ui/core/Lib.load` API:
> In all cases, the lazy libraries need to be loaded manually in the application or library via the [`sap/ui/core/Lib.load`](https://sdk.openui5.org/api/sap.ui.core.Lib%23methods/sap.ui.core.Lib.load) API:
>
> ```
> Library.load("sap.suite.ui.commons").then(...);
> Lib.load({name: "..."}).then(/*...*/);
> ```
> ### Tip:
> Execute the `load` method before any resource of the library is required to preload the complete library instead of loading each resource individually.
>
> Always use the async API as this is the preferred and performant way. If your code relies on synchronous loading, it needs to be refactored to support the async API.
***

Expand All @@ -91,15 +89,9 @@ sap.ui.define(['sap/ui/core/Lib'], function(Library) {

**Scenario 1:** UI library contains multiple components

In this scenario, the library is the leading container and **no** component preload is available. This means, that you maintain the library dependency as described above. This is true for all kinds of component dependencies, also for `sap.ui5/extends/component`. If the extended component originates in a library, do **not** use `sap.ui5.extends/component`, but only declare the library dependency. Otherwise, the component dependency causes a 404 request.

For loading lazy components inside a library, proceed with the library mechanisms as described above:
In this scenario, the library is the leading container and **no** component preload is available. This means, that you maintain the library dependency as described above. This is true for all kinds of component dependencies, also for `sap.ui5/extends/component`. If the extended component originates in a library, do **not** use `sap.ui5/extends/component`, but only declare the library dependency. Otherwise, the component dependency causes a 404 request.

```
sap.ui.define(['sap/ui/core/Lib'], function(Library) {
Library.load("sap.suite.ui.commons").then(...); // lazy loading
});
```
For loading lazy components inside a library, proceed with the library mechanisms as described above.

**Scenario 2:** Standalone component

Expand Down Expand Up @@ -133,7 +125,7 @@ For loading and instantiating \(lazy\) standalone components, use the `createCom
// Asynchronously (default) creates a new component instance.
// The given name parameter has to correspond to an entry in the "sap.ui5/componentUsages" section of the manifest.json.

var oReuseComponentPromise = this.createComponent("myReuseComponent");
var pReuseComponentPromise = this.createComponent("myReuseComponent");


```
Expand All @@ -153,7 +145,7 @@ For more information, see: [Using and Nesting Components](Using_and_Nesting_Comp

[Using and Nesting Components](Using_and_Nesting_Components_346599f.md "You can use a ComponentContainer to wrap a UIComponent and reuse it anywhere within the OpenUI5 control tree. With the ComponentContainer you can nest components inside other components.")

[API Reference: `loadLibrary`](https://sdk.openui5.org/api/sap.ui.core.Core%23methods/loadLibrary)
[API Reference: `sap/ui/core/Lib.load`](https://sdk.openui5.org/api/sap.ui.core.Lib%23methods/sap.ui.core.Lib.load)

[API Reference: `sap.ui.core.Component`](https://sdk.openui5.org/api/sap.ui.core.Component)

0 comments on commit 4acc1e8

Please sign in to comment.