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 Saurabh. This helps. But on the other two questions I asked..

Can we consider sap.ui.getCore().attachInit(function() as kind of promise statement of java script ?

How are we making sure that the application is not waiting till all the SAPUI5 libraries are loaded ? Because, in the above code, we are only waiting for the sap.ui.core library to load but not the other sapui5 libraries like sap.m.