Hi,
I am changing the pre-load property in my index.html tag to ''async".
When I do that, I believe below code makes sure that my application or component.js file doesn't get loaded until all the required SAPUI5 libraries are loaded. If I am correct till now, may I know if sap.ui.getCore().attachInit() acts as a promise and only when this is resolved the callback function within the attachInit() will get executed ?
Again, if I am correct till now, then may I know where are we making sure that sap.m library and other SAPUI5 libraries are also loaded, as I only see attachInit for sap.ui library.
If I am completely off mark, please let me know how do we handle the async pre-load in SAPUI5 applications and how can we set the pre-load='async' property in application where index.html is not available.
<script>
sap.ui.getCore().attachInit(function() {
new sap.m.Shell({
app: new sap.ui.core.ComponentContainer({
height : "100%",
name : "com.sunSampleGetData"
})
}).placeAt("content");
});
</script>
Request clarification before answering.
providing async option will asynchronously load those modules you've provided in the sap-ui-libs, which means other requests will go even if those modules are not loaded yet. check the below blog:
https://blogs.sap.com/2016/10/29/sapui5-application-startup-performance-best-practices/
now the attahInit is not a promise but it is a function which will register your handler function and will call it once the core is loaded. it kinda behaves like a promise but it's definitely not a promise.
https://ui5.sap.com/#/api/sap.ui.core.Core/methods/attachInit
This function you've passed will be called once after the core is loaded successfully and this is independent of teh async option you provide as per my knowledge. BTW as per the latest ui5 standards, you are not supposed to do that and use the below:
https://ui5.sap.com/#/topic/1f81a093a9f3433983dcb2ebe11cd4cd
BR,
Mahesh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 10 | |
| 5 | |
| 5 | |
| 5 | |
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.