cancel
Showing results for 
Search instead for 
Did you mean: 
Subscribe

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>
View Entire Topic
Former Member
0 Likes

Thanks Mahesh. I have a follow up question.

Since index.html file is not used when application is accessed from FIORI launchpad, may I know where and how we can declare preload='async' ?

maheshpalavalli
Active Contributor
0 Likes

Very good question, you don't need to. SAP fiori launchpad will take care of loading the initial resources and via async only for all Ur resources that u mention in manifest.json

What you can do is set to lazy load the libraries.

https://ui5.sap.com/#/topic/408b40efed3c416681e1bd8cdd8910d4

Using this means that libraries loaded when they are required.

Tip: you can click on comment on the answer and reply. We only need to answer if we have solution.

How this helps. Let us know if u need anything.

Br,

Mahesh