John P
Posts: 0
Joined: Tue Oct 14, 2014 7:51 pm

Forcing Javascript files to load in specific order

Is there a way to force javascript files to load in a certain order?

E.g. I need to load a.js first, then b.js, then c.js ... since b.js requires things that are defined in a.js, etc.

From what I can tell, the only way to do this in the UI is to upload them in reverse order (I even tried renaming them so they would sort alphabetically, but that didn't work).

Alena Prykhodko
Posts: 0
Joined: Tue Apr 09, 2013 7:36 am

Forcing Javascript files to load in specific order

Hello John,

This works as with standard JavaScript, please search online for details, for example: http://stackoverflow.com/questions/23...

John P
Posts: 0
Joined: Tue Oct 14, 2014 7:51 pm

Forcing Javascript files to load in specific order

Alena,

Thanks, I do understand that the load order is important ... my question was how can I enforce a load order within Appery?

i.e. if I accidentally upload c.js then a.js then b.js, then the code won't run since the load order that Appery imposes is wrong.

How can I tell Appery that the order needs to be a.js, then b.js, then c.js?

(the only way I figured out is to delete all the javascript files and upload them in reverse order)

Illya Stepanov
Posts: 0
Joined: Mon Mar 18, 2013 8:48 am

Forcing Javascript files to load in specific order

Hi John -

Could you please clarify, how you are adding your JS files, by adding them as JS assets?

John P
Posts: 0
Joined: Tue Oct 14, 2014 7:51 pm

Forcing Javascript files to load in specific order

Yes, I'm adding them as JS assets (uploading them from my laptop).

Illya Stepanov
Posts: 0
Joined: Mon Mar 18, 2013 8:48 am

Forcing Javascript files to load in specific order

Looks like this is the only possible way is to upload them in reverse order.

John P
Posts: 0
Joined: Tue Oct 14, 2014 7:51 pm

Forcing Javascript files to load in specific order

How about a feature request: give us some way to enforce an ordering (similar to what can be done for external resources)

:)

Alena Prykhodko
Posts: 0
Joined: Tue Apr 09, 2013 7:36 am

Forcing Javascript files to load in specific order

John,

You can re-order the files today, using the Up/Down buttons: Image

John P
Posts: 0
Joined: Tue Oct 14, 2014 7:51 pm

Forcing Javascript files to load in specific order

The up/down buttons only show for external javascript code, not for JS-code that you upload yourself. It would be great to have something similar for uploaded JS-code!

Lisa Tassone
Posts: 0
Joined: Tue Jul 07, 2015 2:53 am

Forcing Javascript files to load in specific order

I think having the ability to define the order of all js files included in the app is essential. If I want to override some jQuery Mobile init functions I simply cannot unless I edit the source file. This then makes the file completely uneditable in the visual designer which is one of the main benefits of using Appery. It's extremely frustrating not having more control over this.

Return to “Issues”