Skip to content

Instantly share code, notes, and snippets.

@fantactuka
Created September 27, 2013 08:55
Show Gist options
  • Save fantactuka/6725878 to your computer and use it in GitHub Desktop.
Save fantactuka/6725878 to your computer and use it in GitHub Desktop.
Loading modules in a specific order
var requireQueue = function(modules, callback) {
function load(queue, results) {
if (queue.length) {
require([queue.shift()], function(result) {
results.push(result);
load(queue, results);
});
} else {
callback.apply(null, results);
}
}
load(modules, []);
};
requireQueue([
'app/app',
'app/apps/home/initialize',
'app/apps/main/main-app',
'app/apps/entities/initialize',
'app/apps/external-contact-entities/initialize',
'app/apps/cti/initialize',
'app/apps/fileupload/initialize'
], function(App) {
App.start();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment