Created
December 18, 2013 15:29
-
-
Save Fardinak/8024268 to your computer and use it in GitHub Desktop.
Simple script to load a stack of javascript requisites. Depends on jQuery's getScript.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function loadStack(stack, cb) { | |
if($.isArray(stack)) { | |
if(stack.length === 0) return cb(); | |
// TODO: implement the getScript method to make it standalone | |
$.getScript(stack.shift() + '.js', loadStack.bind(this, stack, cb)); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
loadStack([ | |
// Modules | |
'modules/base', | |
'modules/jalali', | |
'modules/raphael', | |
// Application | |
'app/init', | |
'app/services' | |
], function() { | |
console.log('Initiated.'); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment