@aspiresys/visor 1.1.4 → 1.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +12 -3
- package/dist/index.js +5 -5
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -215,7 +215,10 @@ export declare class Visor {
|
|
|
215
215
|
* @example
|
|
216
216
|
* await visor.wait("loading-done.png");
|
|
217
217
|
*/
|
|
218
|
-
wait(image: string, confidence
|
|
218
|
+
wait(image: string, { confidence, timeout }?: {
|
|
219
|
+
confidence?: number;
|
|
220
|
+
timeout?: number;
|
|
221
|
+
}): Promise<boolean>;
|
|
219
222
|
/**
|
|
220
223
|
* Waits until an image disappears
|
|
221
224
|
* from the screen.
|
|
@@ -241,7 +244,10 @@ export declare class Visor {
|
|
|
241
244
|
* @example
|
|
242
245
|
* await visor.waitToVanish("spinner.png");
|
|
243
246
|
*/
|
|
244
|
-
waitToVanish(image: string, confidence
|
|
247
|
+
waitToVanish(image: string, { confidence, timeout }?: {
|
|
248
|
+
confidence?: number;
|
|
249
|
+
timeout?: number;
|
|
250
|
+
}): Promise<boolean>;
|
|
245
251
|
/**
|
|
246
252
|
* Waits until specific text appears
|
|
247
253
|
* on screen using OCR.
|
|
@@ -877,7 +883,10 @@ export declare class Visor {
|
|
|
877
883
|
* "home-dark.png"
|
|
878
884
|
* ]);
|
|
879
885
|
*/
|
|
880
|
-
waitAny(images: string[], confidence
|
|
886
|
+
waitAny(images: string[], { confidence, timeout }?: {
|
|
887
|
+
confidence?: number;
|
|
888
|
+
timeout?: number;
|
|
889
|
+
}): Promise<boolean>;
|
|
881
890
|
/**
|
|
882
891
|
* Terminates shared OCR worker.
|
|
883
892
|
*
|
package/dist/index.js
CHANGED
|
@@ -295,9 +295,9 @@ CONF:${m.confidence.toFixed(3)}
|
|
|
295
295
|
* @example
|
|
296
296
|
* await visor.wait("loading-done.png");
|
|
297
297
|
*/
|
|
298
|
-
async wait(image, confidence = 0.8, timeout = 5000) {
|
|
298
|
+
async wait(image, { confidence = 0.8, timeout = 5000 } = {}) {
|
|
299
299
|
const interval = 1000;
|
|
300
|
-
const attempts = timeout / interval;
|
|
300
|
+
const attempts = Math.ceil(timeout / interval);
|
|
301
301
|
for (let i = 0; i < attempts; i++) {
|
|
302
302
|
if (await this.exists(image, confidence)) {
|
|
303
303
|
return true;
|
|
@@ -331,7 +331,7 @@ CONF:${m.confidence.toFixed(3)}
|
|
|
331
331
|
* @example
|
|
332
332
|
* await visor.waitToVanish("spinner.png");
|
|
333
333
|
*/
|
|
334
|
-
async waitToVanish(image, confidence = 0.8, timeout = 5000) {
|
|
334
|
+
async waitToVanish(image, { confidence = 0.8, timeout = 5000 } = {}) {
|
|
335
335
|
const start = Date.now();
|
|
336
336
|
while (Date.now() - start < timeout) {
|
|
337
337
|
if (!(await this.exists(image, confidence))) {
|
|
@@ -1088,9 +1088,9 @@ CONF:${m.confidence.toFixed(3)}
|
|
|
1088
1088
|
* "home-dark.png"
|
|
1089
1089
|
* ]);
|
|
1090
1090
|
*/
|
|
1091
|
-
async waitAny(images, confidence = 0.8, timeout = 5000) {
|
|
1091
|
+
async waitAny(images, { confidence = 0.8, timeout = 5000 } = {}) {
|
|
1092
1092
|
const interval = 1000;
|
|
1093
|
-
const attempts = timeout / interval;
|
|
1093
|
+
const attempts = Math.ceil(timeout / interval);
|
|
1094
1094
|
for (let i = 0; i < attempts; i++) {
|
|
1095
1095
|
console.log(`[WAITANY] Attempt ${i + 1}`);
|
|
1096
1096
|
for (const image of images) {
|