mirror of
https://github.com/gnh1201/welsonjs.git
synced 2025-05-15 22:21:04 +00:00
add method console.error()
This commit is contained in:
parent
0c8446b78e
commit
ca1d5c4ec9
27
app.js
27
app.js
|
@ -35,7 +35,7 @@
|
||||||
var messages = [];
|
var messages = [];
|
||||||
|
|
||||||
var console = {
|
var console = {
|
||||||
log: function(msg, status) {
|
log: function(msg) {
|
||||||
if (typeof(window) !== 'undefined') {
|
if (typeof(window) !== 'undefined') {
|
||||||
if (typeof(window.jQuery) !== 'undefined') {
|
if (typeof(window.jQuery) !== 'undefined') {
|
||||||
window.jQuery.toast({
|
window.jQuery.toast({
|
||||||
|
@ -48,8 +48,19 @@ var console = {
|
||||||
}
|
}
|
||||||
} else if (typeof(WScript) !== 'undefined') {
|
} else if (typeof(WScript) !== 'undefined') {
|
||||||
WScript.echo(msg);
|
WScript.echo(msg);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
error: function(msg, status) {
|
||||||
|
this.log(msg);
|
||||||
|
if(typeof(WScript) !== 'undefined') {
|
||||||
WScript.quit(status);
|
WScript.quit(status);
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
info: function(msg) {
|
||||||
|
this.log(msg);
|
||||||
|
},
|
||||||
|
warn: function(msg) {
|
||||||
|
this.log(msg);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -70,7 +81,7 @@ function require(FN) {
|
||||||
TS.Close();
|
TS.Close();
|
||||||
TS = null;
|
TS = null;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log("LOAD ERROR! " + e.number + ", " + e.description + ", FN=" + FN, 1);
|
console.error("LOAD ERROR! " + e.number + ", " + e.description + ", FN=" + FN, 1);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
FSO = null;
|
FSO = null;
|
||||||
|
@ -78,7 +89,7 @@ function require(FN) {
|
||||||
try {
|
try {
|
||||||
cache[FN] = eval(T);
|
cache[FN] = eval(T);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log("PARSE ERROR! " + e.number + ", " + e.description + ", FN=" + FN, 1);
|
console.error("PARSE ERROR! " + e.number + ", " + e.description + ", FN=" + FN, 1);
|
||||||
}
|
}
|
||||||
if ("VERSIONINFO" in cache[FN]) console.log(cache[FN].VERSIONINFO);
|
if ("VERSIONINFO" in cache[FN]) console.log(cache[FN].VERSIONINFO);
|
||||||
return cache[FN];
|
return cache[FN];
|
||||||
|
@ -104,10 +115,10 @@ function init_console() {
|
||||||
WScript.quit(exitstatus);
|
WScript.quit(exitstatus);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
console.log("Error, missing main entry point in " + name + ".js", 1);
|
console.error("Error, missing main entry point in " + name + ".js", 1);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
console.log("Error, cannot find " + name + ".js", 1);
|
console.error("Error, cannot find " + name + ".js", 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -125,13 +136,13 @@ function init_window(name, args, w, h) {
|
||||||
if (app.main) {
|
if (app.main) {
|
||||||
var exitstatus = app.main.call(app, args);
|
var exitstatus = app.main.call(app, args);
|
||||||
if (exitstatus > 0) {
|
if (exitstatus > 0) {
|
||||||
console.log("exit code: " + exitstatus);
|
console.error("error", exitstatus);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
console.log("Error, missing main entry point in " + name + ".js", 1);
|
console.error("Error, missing main entry point in " + name + ".js", 1);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
console.log("Error, cannot find " + name + ".js", 1);
|
console.error("Error, cannot find " + name + ".js", 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
7
uriloader.js
Normal file
7
uriloader.js
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
|
||||||
|
|
||||||
|
return {
|
||||||
|
main: function(args) {
|
||||||
|
console.log(args[0]);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user