mirror of
https://github.com/gnh1201/welsonjs.git
synced 2025-05-16 06:31:04 +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) {
|
function AsyncFunction(f) {
|
||||||
|
this.htmlfile = null;
|
||||||
|
this.proxyWindow = null;
|
||||||
this.f = f;
|
this.f = f;
|
||||||
|
|
||||||
this.run = function() {
|
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() {
|
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;
|
global.GetResource = GetResource;
|
||||||
|
@ -326,9 +343,9 @@ global.splitLn = splitLn;
|
||||||
global.addslashes = addslashes;
|
global.addslashes = addslashes;
|
||||||
global.AsyncFunction = AsyncFunction;
|
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.global = global;
|
||||||
exports.require = global.require;
|
exports.require = global.require;
|
||||||
|
|
||||||
exports.Event = StdEvent;
|
exports.Event = StdEvent;
|
||||||
exports.EventableObject = StdEventableObject;
|
exports.EventableObject = StdEventableObject;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user