Does SAPUI5 load the libraries each time I call jQuery.sap.require("someLibrary")
?
For instance if I am calling the above statement in multiple modules in my application, is "someLibrary" loaded multiple times also?
相关问题
- How to Load Dependencies Relative to Defining Modu
- Generate WSDL web-service objects in SAP
- Shared event handler for XML views with different
- UI5 performance parameters: data-sap-ui-preload vs
- Event for view leave
相关文章
- JCO IDOC Server for multiple destinations
- SAP DI Server - How to issue first request?
- How to use “formatMessage” module with i18n model
- where are the SAPUI5 icons stored?
- How to input only month and year in UI5?
- SAPUI5 JSONModel and JSONP
- Required field validator in sapui5
- How to group SAPUI5 OData before bind to control a
When you call this function with some library, it checks that given library is loaded or not using associative array. If the library is loaded, then it returns
null
. And if the library is not loaded, then it loads the library using sjax call and after a success of the sjax call, it sets the library name as key into associative array.In case someone still considers to use
jQuery.sap.require
, be aware that it sends only sjax requests which should be avoided.Instead, the current best practice is to use
sap.ui.define
or.require
for asynchronous module loading:source: Asynchronify Your App by Arnd vom Hofe
Same as
jQuery.sap.require
,sap.ui.require
also loads module only once since both APIs call the same function namedrequireModule
internally in which the module gets loaded depending on its state.Sync XHRs will be deprecated not only by the web platform generally, but also by UI5 soon.
source: UI5 Evolution by Peter Müßig
Update: The use of
jQuery.sap.require
is now deprecated. The same goes forjQuery.sap.declare
.The lib is only loaded once. You can find this information in the SDK https://sapui5.hana.ondemand.com/sdk/#docs/guide/ModularizationConcept.html
The libraries are loaded once. This can be seen in the network tab in chrome developer tools.
Also check the documentation as pointed by cevou here: