Select to view content in your preferred language

Order of Require

857
4
Jump to solution
04-24-2014 04:46 AM
jaykapalczynski
Honored Contributor
1.  Is there a specific order in which the below have to follow i.e. the PARSER has to come before the MAP  or the READY before the connect?  or can I place them in ANY order as long as the order is the same in the REQUIRE as it is in the FUNCTION
2.  I noticed the containers and Dom/Ready do not require anything in the Function why is that?

Thanks

    require([         "dojo/ready",         "dojo/on",         "dojo/_base/connect",         "dojo/dom",         "dojo/dom-construct",  "dojo/keys", "esri/SnappingManager", "esri/dijit/Measurement", "esri/sniff",         "dojo/parser",         "dijit/registry",   "dijit/layout/BorderContainer", "dijit/layout/ContentPane",  "dijit/layout/AccordionContainer",  "dojo/domReady!"     ], function(         ready,         on,         connect,         dom,         domConstruct,  keys, SnappingManager, Measurement, has,         parser,         registry     ) {
0 Kudos
1 Solution

Accepted Solutions
TimWitt
Deactivated User
Jay

this should clear up a lot of your questions. In addition, since all modules are loaded at the beginning, the order doesn't matter, as long as you keep the order in your require([]) the same as in your following function() and put "dojo/domReady!" last in your require([]) list.


Tim

View solution in original post

0 Kudos
4 Replies
TimWitt
Deactivated User
Jay

this should clear up a lot of your questions. In addition, since all modules are loaded at the beginning, the order doesn't matter, as long as you keep the order in your require([]) the same as in your following function() and put "dojo/domReady!" last in your require([]) list.


Tim
0 Kudos
JeffPace
MVP Alum
Containers dont need aliases if you only use them in defined HTML

If you try to create them programmatically (new BorderContainer) you will need an alias.  It is my opinion, for both readability of code and preventing errors down the road, to just add aliases for everything.  It doesn't hurt anything and can prevent alot of problems
0 Kudos
jaykapalczynski
Honored Contributor
Thanks for your thoughts....both of ya....appreciated.
Thats what I was figuring...I had the containers aliases in there at one time but took them out as another example didnt have them in there.
Cool...thanks....
0 Kudos
JohnGravois
Deactivated User
just to pile on...
when each individual module is loaded, its own dependencies are resolved automatically by the dojo loader, and additional requests for supporting code are made automatically, if necessary. 

the require callback isn't triggered until all the asynchronous responses have been received.  this allows us to load modules in whatever order we like.
0 Kudos