mirror of
https://github.com/gnh1201/welsonjs.git
synced 2025-05-15 14:11:03 +00:00
Update app.js, lib/std.js
This commit is contained in:
parent
04c2325ade
commit
cfc9501554
23
app.js
23
app.js
|
@ -33,15 +33,17 @@
|
||||||
// must define main = function(args) {}, which is called once the module is
|
// must define main = function(args) {}, which is called once the module is
|
||||||
// loaded.
|
// loaded.
|
||||||
//
|
//
|
||||||
// Report abuse or security issue: abuse@catswords.net
|
// app.js
|
||||||
|
// Namhyeon Go <abuse@catswords.net>
|
||||||
// https://github.com/gnh1201/welsonjs
|
// https://github.com/gnh1201/welsonjs
|
||||||
|
// If you find an abuse case or a security issue, please feel free to contact me.
|
||||||
//
|
//
|
||||||
|
|
||||||
var exit = function(status) {
|
var exit = function(status) {
|
||||||
console.error("Exit", status, "caused");
|
console.error("Exit", status, "caused");
|
||||||
|
|
||||||
if (typeof WScript !== "undefined") {
|
if (typeof WScript !== "undefined") {
|
||||||
WScript.quit(status);
|
WScript.Quit(status);
|
||||||
} else if (typeof window !== "undefined") {
|
} else if (typeof window !== "undefined") {
|
||||||
window.close();
|
window.close();
|
||||||
}
|
}
|
||||||
|
@ -63,7 +65,7 @@ var console = {
|
||||||
_echoCallback: null,
|
_echoCallback: null,
|
||||||
_wshEcho: function(message) {
|
_wshEcho: function(message) {
|
||||||
if (typeof WScript !== "undefined") {
|
if (typeof WScript !== "undefined") {
|
||||||
WScript.echo("[*] " + message)
|
WScript.Echo("[*] " + message)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
_echo: function(args, type) {
|
_echo: function(args, type) {
|
||||||
|
@ -187,7 +189,12 @@ if (typeof CreateObject === "undefined") {
|
||||||
};
|
};
|
||||||
CreateObject.make = function(p, s) {
|
CreateObject.make = function(p, s) {
|
||||||
if (typeof WScript !== "undefined") {
|
if (typeof WScript !== "undefined") {
|
||||||
|
if ("CreateObject" in WScript) {
|
||||||
return WScript.CreateObject(p, s);
|
return WScript.CreateObject(p, s);
|
||||||
|
} else {
|
||||||
|
console.warn("(Chakra) The standalone engine does not supported. Please use the built-in engine.");
|
||||||
|
console.warn("(Chakra) hint:", "cscript //NoLogo //E:{1b7cd997-e5ff-4932-a7a6-2a9e636da385} app.js <filename> <...arguments>");
|
||||||
|
}
|
||||||
} else if (typeof ActiveXObject !== "undefined") {
|
} else if (typeof ActiveXObject !== "undefined") {
|
||||||
return new ActiveXObject(p);
|
return new ActiveXObject(p);
|
||||||
}
|
}
|
||||||
|
@ -324,10 +331,16 @@ require.__getDirName__ = function(path) {
|
||||||
};
|
};
|
||||||
require.__getCurrentScriptDirectory__ = function() {
|
require.__getCurrentScriptDirectory__ = function() {
|
||||||
if (typeof WScript !== "undefined") {
|
if (typeof WScript !== "undefined") {
|
||||||
|
if ("ScriptFullName" in WScript) {
|
||||||
return require.__getDirName__(WScript.ScriptFullName);
|
return require.__getDirName__(WScript.ScriptFullName);
|
||||||
|
} else {
|
||||||
|
console.warn("Could not resolve an absolute path. Use the relative path.");
|
||||||
|
return ".";
|
||||||
|
}
|
||||||
} else if (typeof document !== "undefined") {
|
} else if (typeof document !== "undefined") {
|
||||||
return require.__getDirName__(document.location.pathname);
|
return require.__getDirName__(document.location.pathname);
|
||||||
} else {
|
} else {
|
||||||
|
console.warn("Could not resolve an absolute path. Use the relative path.");
|
||||||
return ".";
|
return ".";
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -493,7 +506,9 @@ function initializeWindow(name, args, w, h) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// JSON 2
|
// JSON 2
|
||||||
__include__("app/assets/js/json2");
|
if (typeof JSON === "undefined") {
|
||||||
|
__include__("app/assets/js/json2");
|
||||||
|
}
|
||||||
|
|
||||||
// core-js (aka. babel-polyfill)
|
// core-js (aka. babel-polyfill)
|
||||||
require("app/assets/js/core-js-3.26.1.minified");
|
require("app/assets/js/core-js-3.26.1.minified");
|
||||||
|
|
|
@ -30,7 +30,8 @@ if (!Function.prototype.GetResource) {
|
||||||
// The provided code snippet has been corrected by ChatGPT.
|
// The provided code snippet has been corrected by ChatGPT.
|
||||||
// https://chat.openai.com/share/eaab056c-d265-4ee3-b355-9f29176a9caa
|
// https://chat.openai.com/share/eaab056c-d265-4ee3-b355-9f29176a9caa
|
||||||
// Related issues: #75 #42 #30
|
// Related issues: #75 #42 #30
|
||||||
Enumerator.prototype.toArray = function() {
|
if (typeof Enumerator !== "undefined") {
|
||||||
|
Enumerator.prototype.toArray = function() {
|
||||||
var result = [];
|
var result = [];
|
||||||
while (!this.atEnd()) {
|
while (!this.atEnd()) {
|
||||||
var currentItem = this.item();
|
var currentItem = this.item();
|
||||||
|
@ -61,7 +62,8 @@ Enumerator.prototype.toArray = function() {
|
||||||
this.moveNext();
|
this.moveNext();
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
// Global APIs
|
// Global APIs
|
||||||
|
@ -583,7 +585,7 @@ exports.Storage = StdStorage;
|
||||||
exports.alert = alert;
|
exports.alert = alert;
|
||||||
exports.confirm = confirm;
|
exports.confirm = confirm;
|
||||||
|
|
||||||
exports.VERSIONINFO = "Standard Library (std.js) version 0.8.3";
|
exports.VERSIONINFO = "Standard Library (std.js) version 0.8.4";
|
||||||
exports.AUTHOR = "abuse@catswords.net";
|
exports.AUTHOR = "abuse@catswords.net";
|
||||||
exports.global = global;
|
exports.global = global;
|
||||||
exports.require = global.require;
|
exports.require = global.require;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user