Update std.js

This commit is contained in:
Namhyeon Go 2022-02-25 14:42:17 +09:00 committed by GitHub
parent 41ae841177
commit 07d8a749a2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -307,13 +307,30 @@ function StdEventableObject() {
};
function AsyncFunction(f) {
this.htmlfile = null;
this.proxyWindow = null;
this.f = f;
this.run = function() {
sleep(1, this.f);
if (this.proxyWindow != null) {
this.proxyWindow.setTimeout(1, this.f);
} else {
sleep(1, this.f);
}
};
this.runSynchronously = function() {
return this.f();
return this.f.apply(null, arguments);
};
// https://qiita.com/abcang/items/80b5733b5a96eeff9945
if (typeof WScript !== "undefined") {
try {
this.htmlfile = CreateObject("htmlfile");
this.proxyWindow = this.htmlfile.parentWindow;
} catch (e) {
console.warn("AsyncFunction require HTMLFILE object in WScript");
}
}
};
global.GetResource = GetResource;
@ -326,9 +343,9 @@ global.splitLn = splitLn;
global.addslashes = addslashes;
global.AsyncFunction = AsyncFunction;
exports.VERSIONINFO = "Standard Lib (std.js) version 0.4";
exports.VERSIONINFO = "Standard Lib (std.js) version 0.5";
exports.global = global;
exports.require = global.require;
exports.Event = StdEvent;
exports.EventableObject = StdEventableObject;
exports.EventableObject = StdEventableObject;