From 4acc1e8824df7d4fc4c14983ae1f0474f19ee91e Mon Sep 17 00:00:00 2001 From: OpenUI5 Bot Date: Tue, 28 May 2024 08:16:39 +0000 Subject: [PATCH] OpenUI5 Documentation Update 28.05.2024 --- ...ies_to_Libraries_and_Components_8521ad1.md | 20 ++++++------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/docs/Descriptor_Dependencies_to_Libraries_and_Components_8521ad1.md b/docs/Descriptor_Dependencies_to_Libraries_and_Components_8521ad1.md index 8e95349e..000a03bc 100644 --- a/docs/Descriptor_Dependencies_to_Libraries_and_Components_8521ad1.md +++ b/docs/Descriptor_Dependencies_to_Libraries_and_Components_8521ad1.md @@ -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. *** @@ -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 @@ -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"); ``` @@ -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)