mirror of
https://github.com/gnh1201/welsonjs.git
synced 2025-05-11 20:21:03 +00:00
Update std.js
This commit is contained in:
parent
41ae841177
commit
07d8a749a2
25
lib/std.js
25
lib/std.js
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue
Block a user