Prevent crash system if cannot load a js script or style sheet.

This commit is contained in:
Rodrigo Ramírez Norambuena 2017-02-12 13:06:11 -03:00
parent ff19cb68b4
commit 8bda91aafb

View File

@ -186,6 +186,11 @@ var Loader = (function() {
script.onload = function() {
if (typeof callback === "function") {callback();}
};
script.onerror = function() {
console.error("Error on loading script:", fileName);
if (typeof callback === "function") {callback();}
};
document.getElementsByTagName("body")[0].appendChild(script);
break;
case "css":
@ -197,6 +202,11 @@ var Loader = (function() {
stylesheet.onload = function() {
if (typeof callback === "function") {callback();}
};
stylesheet.onerror = function() {
console.error("Error on loading stylesheet:", fileName);
if (typeof callback === "function") {callback();}
};
document.getElementsByTagName("head")[0].appendChild(stylesheet);
break;
}