mirror of
https://github.com/gnh1201/welsonjs.git
synced 2026-04-18 18:18:42 +00:00
Evaluate console._muted at load time
Convert console._muted from a function to a boolean by invoking an IIFE during module initialization. This reads the WScript 'quiet' flag once and stores the result, and updates _echoCallback to reference the boolean (remove the function call). This simplifies usage and avoids repeated runtime checks.
This commit is contained in:
parent
4c48fdbb4d
commit
55f6f1c438
6
app.js
6
app.js
|
|
@ -36,16 +36,16 @@ var console = {
|
|||
}
|
||||
return res;
|
||||
},
|
||||
_muted: function() {
|
||||
_muted: (function() {
|
||||
try {
|
||||
if (typeof WScript !== "undefined")
|
||||
return WScript.Arguments.Named.Exists("quiet");
|
||||
} catch (e) { /* ignore */ }
|
||||
|
||||
return false;
|
||||
},
|
||||
})(),
|
||||
_echoCallback: function(params, type) {
|
||||
if (this._muted()) return;
|
||||
if (this._muted) return;
|
||||
|
||||
if (typeof WScript !== "undefined") {
|
||||
WScript.StdOut.WriteLine("[*] " + params.message);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user