The library preload file library-preload.js
contains all modules of a certain
library. These modules will only be executed on demand, if the application requires
them. Using preloads significantly reduces the number of roundtrips since the single
modules are bundled in one file.
An application must not reference the
library-preload.js
. If preload files exist, SAPUI5 automatically loads
them. The dependencies to libraries are defined as part of the manifest namespace
sap.ui5/dependencies/libs
. For further information, see Manifest (Descriptor for Applications, Components, and Libraries).
By setting the async=true
configuration parameter, the module loader loads the modules and preload files asynchronously.
You can enable it in an existing application by specifying the sap-ui-async
configuration parameter in the start URL, or
by adding the data-sap-ui-async
attribute to the bootstrap tag:
<script id="sap-ui-bootstrap" src="resources/sap-ui-core.js" data-sap-ui-async="true" data-sap-ui-on-init="module:my/app/main" data-sap-ui-resource-roots='{"my.app": "./"}' ></script>
Before you use the async
configuration parameter, make sure your app is ready for asynchronous loading, see Best Practices for Loading Modules and Is Your Application Ready for Asynchronous Loading?.