mirror of
https://github.com/gnh1201/welsonjs.git
synced 2024-11-26 07:21:43 +00:00
Update std.js
This commit is contained in:
parent
2f74ceb013
commit
0f57fba805
42
lib/std.js
42
lib/std.js
|
@ -255,16 +255,49 @@ function alert(message) {
|
|||
if (typeof window !== "undefined") {
|
||||
window.alert(message);
|
||||
} else {
|
||||
CreateObject("WScript.Shell").Popup(message);
|
||||
try {
|
||||
CreateObject("WScript.Shell").Popup(message, 0, "WelsonJS", 0);
|
||||
} catch (e) {
|
||||
console.error(e.message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function confirm(message) {
|
||||
var result;
|
||||
|
||||
if (typeof window !== "undefined") {
|
||||
return window.confirm(message);
|
||||
result = window.confirm(message);
|
||||
} else {
|
||||
CreateObject("WScript.Shell").Popup(message);
|
||||
try {
|
||||
result = (CreateObject("WScript.Shell").Popup(message, 0, "WelsonJS", 4) == 6);
|
||||
} catch (e) {
|
||||
console.error(e.message);
|
||||
result = false;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
function prompt(message, _default) {
|
||||
var result;
|
||||
|
||||
if (typeof window !== "undefined") {
|
||||
result = window.prompt(message);
|
||||
} else {
|
||||
try {
|
||||
result = CreateObject("WelsonJS.Toolkit").Prompt(message);
|
||||
} catch (e) {
|
||||
console.error(e.message);
|
||||
if (typeof _default !== "undefined") {
|
||||
result = _default;
|
||||
console.warn("Use default value:", _default);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
function parseEnv(s) {
|
||||
|
@ -551,8 +584,9 @@ exports.Storage = StdStorage;
|
|||
|
||||
exports.alert = alert;
|
||||
exports.confirm = confirm;
|
||||
exports.prompt = prompt;
|
||||
|
||||
exports.VERSIONINFO = "WelsonJS Standard Library (std.js) version 0.8.12";
|
||||
exports.VERSIONINFO = "WelsonJS Standard Library (std.js) version 0.8.13";
|
||||
exports.AUTHOR = "abuse@catswords.net";
|
||||
exports.global = global;
|
||||
exports.require = global.require;
|
||||
|
|
Loading…
Reference in New Issue
Block a user