Академический Документы
Профессиональный Документы
Культура Документы
8521ad1955f340f9a6207d615c88d7fd
view on: demo kit nightly build | demo kit latest release
Dependencies to Libraries
The following dependencies to libraries can be implemented:
• To benefit from the asynchronous library preload, add the mandatory libraries to
sap.ui5/dependencies/libs.
• To expose the necessary dependencies for offline packages for mobile devices, add
optional libraries to sap.ui5/dependencies/libs and flag them as lazy.
For libraries, modify the .library file as shown in the follown code sample. This file is
available because the manifest.json for libraries is generated based on this metadata.
<dependencies>
<dependency>
<libraryName>sap.m</libraryName>
</dependency>
<dependency>
<libraryName>sap.suite.ui.commons</libraryName>
<lazy>true</lazy>
</dependency>
...
Note: In all cases, the lazy libraries need to be loaded manually in the application or library via the loadLibrary
API:
// lazy lib loaded synchronously (avoid if possible!)
sap.ui.getCore().loadLibrary("sap.suite.ui.commons");
Dependencies to Components
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:
// lazy lib loaded synchronously (avoid if possible!)
sap.ui.getCore().loadLibrary("sap.suite.ui.commons");
For loading/instantiating the lazy standalone components, use the component factory
functions:
// "Component" required from module "sap/ui/core/Component"
Related information
loadLibrary
Component