Update toolkit.js

This commit is contained in:
Namhyeon Go 2022-02-14 16:03:55 +09:00 committed by GitHub
parent 1c799401ba
commit 52bfa45f9a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -13,41 +13,46 @@ var ToolkitObject = function() {
console.warn("WelsonJS.Toolkit is disabled");
}
};
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);
};
// 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.getInterface = function() {
return this.interface;
};
this.create();
};
var Toolkit = new ToolkitObject();
exports.create = Toolkit.create;
exports.sendClick = Toolkit.sendClick;
exports.sendKeys = Toolkit.sendKeys;
exports.alert = Toolkit.alert;
exports.confirm = Toolkit.confirm;
exports.prompt = Toolkit.prompt;
exports.create = function() {
return new ToolkitObject();
};
exports.getInterface = function() {
return Toolkit.getInterface();
};
exports.sendClick = function(wName, x, y, retry) {
var i = 0;
while (i < retry) {
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);
};