Use Log in loader too

This commit is contained in:
rejas 2020-05-11 23:13:53 +02:00
parent c60446a015
commit 0cae954f80

View File

@ -176,16 +176,12 @@ var Loader = (function () {
var script = document.createElement("script"); var script = document.createElement("script");
script.type = "text/javascript"; script.type = "text/javascript";
script.src = fileName; script.src = fileName;
script.onload = function () { script.onload = function() {
if (typeof callback === "function") { if (typeof callback === "function") {callback();}
callback();
}
}; };
script.onerror = function () { script.onerror = function() {
console.error("Error on loading script:", fileName); Log.error("Error on loading script:", fileName);
if (typeof callback === "function") { if (typeof callback === "function") {callback();}
callback();
}
}; };
document.getElementsByTagName("body")[0].appendChild(script); document.getElementsByTagName("body")[0].appendChild(script);
@ -196,16 +192,12 @@ var Loader = (function () {
stylesheet.rel = "stylesheet"; stylesheet.rel = "stylesheet";
stylesheet.type = "text/css"; stylesheet.type = "text/css";
stylesheet.href = fileName; stylesheet.href = fileName;
stylesheet.onload = function () { stylesheet.onload = function() {
if (typeof callback === "function") { if (typeof callback === "function") {callback();}
callback();
}
}; };
stylesheet.onerror = function () { stylesheet.onerror = function() {
console.error("Error on loading stylesheet:", fileName); Log.error("Error on loading stylesheet:", fileName);
if (typeof callback === "function") { if (typeof callback === "function") {callback();}
callback();
}
}; };
document.getElementsByTagName("head")[0].appendChild(stylesheet); document.getElementsByTagName("head")[0].appendChild(stylesheet);