Update toolkit.js

This commit is contained in:
Namhyeon Go 2022-02-14 15:43:14 +09:00 committed by GitHub
parent 914742a03e
commit 5f18e774fa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -10,49 +10,44 @@ var ToolkitObject = function() {
this.interface = CreateObject("WelsonJS.Toolkit");
return this;
} catch (e) {
console.error("ToolkitObject.create() ->", e.message);
console.warn("WelsonJS.Toolkit is disabled");
}
};
this.getInterface = function() {
return this.interface;
this.sendClick = function(wName, x, y, retry) {
var i = 0;
while (i < retry) {
this.interface.SendClick(wName, x, y);
i++;
}
};
this.sendKeys = function(wName, s) {
return this.interface.SendKeys(wName, s);
};
this.create();
// https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html
this.alert = function(message) {
return this.interface.Alert(message);
};
this.confirm = function(message) {
return this.interface.Confirm(message);
};
this.prompt = function(message, _default) {
return this.interface.Prompt(message, _default);
};
this.create();
};
var Toolkit = new ToolkitObject();
exports.create = function() {
return new ToolkitObject();
};
exports.getInterface = function() {
return Toolkit.getInterface();
};
exports.sendClick = function(wName, x, y, repeat) {
var i = 0;
while (i < repeat) {
Toolkit.getInterface().SendClick(wName, x, y);
i++;
}
};
exports.sendKeys = function(wName, s) {
return Toolkit.getInterface().SendKeys(wName, s);
};
// https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html
exports.alert = function(message) {
return Toolkit.getInterface().Alert(message);
};
exports.confirm = function(message) {
return Toolkit.getInterface().Confirm(message);
};
exports.prompt = function(message, _default) {
return Toolkit.getInterface().Prompt(message, _default);
};
exports.create = Toolkit.create();
exports.sendClick = Toolkit.sendClick;
exports.sendKeys = Toolkit.sendKeys;
exports.alert = Toolkit.alert;
exports.confirm = Toolkit.confirm;
exports.prompt = Toolkit.prompt;