mirror of
https://github.com/gnh1201/welsonjs.git
synced 2025-05-11 20:21:03 +00:00
Update toolkit.js
This commit is contained in:
parent
914742a03e
commit
5f18e774fa
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue
Block a user