mercredi 15 avril 2015

Problems with dynamically loading custom 'build' JS files

We're having some issues dynamically loading custom JS files that contain multiple Ext.define(s).



Loading the file works fine if the class definitions have all been added in the 'correct' order. That is, definitions that are 'require'd by other definitions are placed at the top.



If the file is build by concatenating all the definitions without regard to which classes require other classes, then we run into problems.



For example, if class A requires class B and the file contains Ext.define('A'...) then Ext.define('B') (in that order), when the file is loaded, the process seems to be:



A gets defined.

B gets added to Ext.Boot.suspendedQueue (because A requires it)

Bgets defined.

Then the loader tries to fetch B's stand-alone JS file from the server (it seems to disregard the fact that B's class definition has just been loaded).



Any ideas on what we can do to fix the problem?

Do we have to change our custom build scripts to 'know' which classes require other classes and concatenate them in the correct order?

Can we somehow tell the loader to 'assume all required class definitions will be in this file and don't bother building a suspendedQueue'?

Any other suggestions?



Thank you very much!

David





Problems with dynamically loading custom 'build' JS files

Aucun commentaire:

Enregistrer un commentaire