[go: nahoru, domu]

Skip to content

Commit

Permalink
util.js: script load sequential execution changes.
Browse files Browse the repository at this point in the history
Related to issue: novnc#205

Split out the function to load a single script to Util.load_script.

In order to get sequential load, when on IE set the script defer flag.
It is currently working on webkit and firefox but just in case also
set the script.async flag to make sure that scripts execute in the
order they are added. Scripts should still load in parallel.
  • Loading branch information
kanaka committed Nov 1, 2012
1 parent e7e6660 commit 5156299
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions include/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -242,10 +242,11 @@ Util.load_scripts = function(files) {
this.onload = this.onreadystatechange = null;
//console.log("completed script: " + this.src);
ps.splice(ps.indexOf(this), 1);
}
// Call window.onscriptsload after last script loads
if (ps.length === 0 && window.onscriptsload) {
window.onscriptsload();

// Call window.onscriptsload after last script loads
if (ps.length === 0 && window.onscriptsload) {
window.onscriptsload();
}
}
}
};
Expand Down

0 comments on commit 5156299

Please sign in to comment.