cancel
Showing results for 
Search instead for 
Did you mean: 

Load all controller files

Former Member
0 Kudos

Hey,

i want to make my App offline capable. How can I load all controller files at the beginning of my App? Currently the controller files only get loaded when they are needed.

Thanks for your help and best regards,

David

Accepted Solutions (0)

Answers (2)

Answers (2)

jamie_cawley
Advisor
Advisor
0 Kudos

Create a component-preload.js file with all of the app contents contained within it.

https://help.hana.ondemand.com/webide/frameset.htm?dfb26ef028624cf486a8bbb0bfd459ff.html

Regards,

Jamie

SAP - Technology RIG

NabiZamani
Contributor
0 Kudos

I'd also say this is the best approach to answer the question: you app should be a component based app that loads the Component-preload.js file. I don't know how your dev setup looks like, but it's quite easy to generate the Component-preload.js file using grunt. Have a look at grunt-openui5 and also at the Optimizing UI5 Apps blog by Matthias Osswald. The blog Deploying UI5: Putting all the tasks together by Nigel James is another good read.

Using this approach even makes sure you have your views loaded as well. However, keep in mind that some resources like image files etc. will not be available for offline use this way. So for those other resources (which will not be part of the generated Component-preload.js file) you should implement a "pre-fetching" strategy if this is really needed (maybe inside the Component.js file).

0 Kudos

Or you can use Gulp as task runner: Distribution package for an UI5 application

former_member227918
Active Contributor
0 Kudos

using <script> tag you can load all javascripts files inside <head> tag in index.html.

Regards,

Akhilesh

Former Member
0 Kudos

How can I reach the same effect without having a index.html?

former_member227918
Active Contributor
0 Kudos

you must have one html file in your app, you can use that file.

OR

you can use jQuery.sap.require, check below link, or you can use component-preload as Jamie suggested.

Modularization and Dependency Management

Thanks,

Akhilesh