use loadScriptsParallel
This commit is contained in:
parent
5086c5da90
commit
093af4ee35
1 changed files with 7 additions and 6 deletions
13
source/Ox.js
13
source/Ox.js
|
@ -58,24 +58,25 @@ window.Ox = {
|
|||
}
|
||||
|
||||
function loadScripts(scripts, callback) {
|
||||
loadScriptsOrdered(scripts[0], function() {
|
||||
loadScriptsUnordered(scripts[1], function() {
|
||||
loadScriptsUnordered(scripts[2], callback);
|
||||
loadScriptsParallel(scripts[0], function() {
|
||||
loadScriptsParallel(scripts[1], function() {
|
||||
loadScriptsParallel(scripts[2], callback);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function loadScriptsOrdered(scripts, callback) {
|
||||
// fixme: unused
|
||||
function loadScriptsSerial(scripts, callback) {
|
||||
loadScript(scripts.shift(), function() {
|
||||
if (scripts.length) {
|
||||
loadScriptsOrdered(scripts, callback);
|
||||
loadScriptsSerial(scripts, callback);
|
||||
} else {
|
||||
callback();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function loadScriptsUnordered(scripts, callback) {
|
||||
function loadScriptsParallel(scripts, callback) {
|
||||
var counter = 0, i, length = scripts.length;
|
||||
for (i = 0; i < length; i++) {
|
||||
loadScript(scripts[i], function() {
|
||||
|
|
Loading…
Reference in a new issue