So I’m using the Dojo 1.7 ‘require’ syntax to fire off two modules. However, the order that these modules are called is important, as one works on the results of the other.
I can’t just lay them out procedurally… how do I ensure they fire in order?
require(['modules/createElements', 'dojo/domReady!'],
function(createElements) {
createElements.go();
});
require(['modules/modifyElements', 'dojo/domReady!'],
function(modifyElements) {
// This is supposed to modify the elements created
// by the createElements module, but it usually fires
// _before_ the elements have been created!
modifyElements.go();
});
Ideally I’d like the two modules to be more-or-less independent of eachother (e.g. so that modifyElements can act on elements created by any source), so calling modifyElements at the end of createElements is not desirable.
Aha, I realized moments after posting this that I can just do all my work from within a single
require, like so: