Page 1 of 2

Forcing Javascript files to load in specific order

Posted: Thu Jul 09, 2015 5:34 pm
by John P

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).


Forcing Javascript files to load in specific order

Posted: Sat Jul 11, 2015 1:54 am
by Alena Prykhodko

Hello John,

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


Forcing Javascript files to load in specific order

Posted: Sat Jul 11, 2015 5:17 pm
by John P

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)


Forcing Javascript files to load in specific order

Posted: Sat Jul 11, 2015 6:26 pm
by Illya Stepanov

Hi John -

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


Forcing Javascript files to load in specific order

Posted: Sat Jul 11, 2015 7:27 pm
by John P

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


Forcing Javascript files to load in specific order

Posted: Sat Jul 11, 2015 9:24 pm
by Illya Stepanov

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


Forcing Javascript files to load in specific order

Posted: Sat Jul 11, 2015 11:48 pm
by John P

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

:)


Forcing Javascript files to load in specific order

Posted: Mon Jul 13, 2015 8:37 pm
by Alena Prykhodko

John,

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


Forcing Javascript files to load in specific order

Posted: Tue Jul 14, 2015 12:15 am
by John P

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!


Forcing Javascript files to load in specific order

Posted: Fri Mar 18, 2016 1:28 am
by Lisa Tassone

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.