From def8d5ff5c230a90dbada351d7bf83e6df503479 Mon Sep 17 00:00:00 2001 From: Simon Hofmann Date: Tue, 7 Dec 2021 23:14:13 +0100 Subject: [PATCH] (#312) Added new parameter `updateInterval` to `waitFor` to make the interval user configurable --- lib/screen.class.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/screen.class.ts b/lib/screen.class.ts index 2034f2f0..0ea0b6ac 100644 --- a/lib/screen.class.ts +++ b/lib/screen.class.ts @@ -213,14 +213,16 @@ export class ScreenClass { * {@link waitFor} searches for a template image for a specified duration * @param templateImage Filename of the template image, relative to {@link ScreenClass.config.resourceDirectory}, or an {@link Image} * @param timeoutMs Timeout in milliseconds after which {@link waitFor} fails + * @param updateInterval Update interval in milliseconds to retry search * @param params {@link LocationParameters} which are used to fine tune search region and / or match confidence */ public async waitFor( templateImage: FirstArgumentType, timeoutMs: number = 5000, + updateInterval: number = 500, params?: LocationParameters, ): Promise { - return timeout(500, timeoutMs, () => this.find(templateImage, params), {signal: params?.abort}); + return timeout(updateInterval, timeoutMs, () => this.find(templateImage, params), {signal: params?.abort}); } /**