Update app.js

This commit is contained in:
Namhyeon Go 2024-07-21 18:37:54 +09:00 committed by GitHub
parent 8b5abfe022
commit b096dbe7c6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

21
app.js
View File

@ -62,17 +62,17 @@ var console = {
} }
return res; return res;
}, },
_echoCallback: null, _echoDefault: function(message) {
_wshEcho: function(message) {
if (typeof WScript !== "undefined") { if (typeof WScript !== "undefined") {
WScript.Echo("[*] " + message) WScript.Echo("[*] " + message)
} }
}, },
_echoCallback: null,
_echo: function(args, type) { _echo: function(args, type) {
var message = ""; var message = "";
var params = { var params = {
type: type, type: type,
channel: 'default', scope: [],
message: '', message: '',
datetime: new Date().toISOString() datetime: new Date().toISOString()
}; };
@ -85,7 +85,7 @@ var console = {
} else { } else {
message += this._join(args); message += this._join(args);
} }
this._wshEcho(message); this._echoDefault(message);
this._messages.push(message); this._messages.push(message);
params.message = message; params.message = message;
} else if (typeof args[0] === "object") { } else if (typeof args[0] === "object") {
@ -96,7 +96,7 @@ var console = {
message += args[0].message; message += args[0].message;
} }
} }
this._wshEcho(message); this._echoDefault(message);
this._messages.push(args[0].message); this._messages.push(args[0].message);
for (var k in args[0]) { for (var k in args[0]) {
params[k] = args[0][k]; params[k] = args[0][k];
@ -104,18 +104,18 @@ var console = {
} }
} }
if (params.channel != "default" && this._echoCallback != null) { if (params.scope.length > 0 && this._echoCallback != null) {
try { try {
this._echoCallback(params, type); this._echoCallback(params, type);
} catch (e) { } catch (e) {
this._wshEcho("Exception on _echoCallback: " + e.message); this._echoDefault("Exception:" + e.message);
} }
} }
}, },
assert: function(assertion) { assert: function(assertion) {
if (arguments.length > 1 && assertion === arguments[0]) { if (arguments.length > 1 && assertion === arguments[0]) {
if(!assertion) { if(!assertion) {
this.error("Assertion failed: " + this._join(arguments.slice(1))); this.error("Assertion failed:", this._join(arguments.slice(1)));
} }
} }
}, },
@ -576,9 +576,8 @@ function __main__() {
console.log(" \\_/\\_/ \\___|_|___/\\___/|_| |_|\\___/|____/ "); console.log(" \\_/\\_/ \\___|_|___/\\___/|_| |_|\\___/|____/ ");
console.log(""); console.log("");
console.log(" WelsonJS - Build a Windows app on the Windows built-in JavaScript engine"); console.log(" WelsonJS - Build a Windows app on the Windows built-in JavaScript engine");
console.log(" C-2021-000237 (cros.or.kr)"); console.log(" C-2021-000237 (cros.or.kr), 10.5281/zenodo.11382385 (doi.org), 2023-A0562 (oss.kr), Codename Macadamia");
console.log(" 10.5281/zenodo.11382385 (doi.org)"); console.log(" This software is distributed as open source under the GPL 3.0 or MS-RL licenses.");
console.log(" This software is distributed as open source under the GPL 3.0 or MS-RL licenses.");
console.log(" https://github.com/gnh1201/welsonjs"); console.log(" https://github.com/gnh1201/welsonjs");
console.log(""); console.log("");