how can we make a function from arrays like
$.loader({
js: [
['1.js','3.js','2.js'],
['4.js'],
['5.js']
]
});
into something that does
$.when(
$.getScript("1.js"),
$.getScript('3.js'),
$.getScript('2.js'))
.then(
function(){
$.getScript('4.js').then(function(){
$.getScript('5.js');
})
});
heres what currently im working on
loader: function(arg){
var js = arg;
var phase = 0;
for (var i = 0; i < o.length; i++) {
console.log(o[i]);
$.each(o[i], function(key,src) {
//append javascript
});
};
}

the problem is i dont know where to start. heres what i have in mind
- i divide them into phases.
- set phase 0, it will run the fist array but how can i do it ?
$.getScript(src)for each src dosent stack. or chain. maybe put it one var sting ? likestring + = $.getScript(src).so it will be like$.getScript("1.js").getScript("3.js").getScript("2.js")until there is arrays of string which is 3 in this example. then do something like append$.when(infront of the string then at the back of the string we put.then(function(){until it finish then somehow closed the string. - ok i dont know ( and here goes the post at stackoverflow )