Skip to content

Commit 6ca2a4d

Browse files
authored
(#312) Added new parameter updateInterval to waitFor to make the interval user configurable (#333)
1 parent 4fbc831 commit 6ca2a4d

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/screen.class.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -213,14 +213,16 @@ export class ScreenClass {
213213
* {@link waitFor} searches for a template image for a specified duration
214214
* @param templateImage Filename of the template image, relative to {@link ScreenClass.config.resourceDirectory}, or an {@link Image}
215215
* @param timeoutMs Timeout in milliseconds after which {@link waitFor} fails
216+
* @param updateInterval Update interval in milliseconds to retry search
216217
* @param params {@link LocationParameters} which are used to fine tune search region and / or match confidence
217218
*/
218219
public async waitFor(
219220
templateImage: FirstArgumentType<typeof ScreenClass.prototype.find>,
220221
timeoutMs: number = 5000,
222+
updateInterval: number = 500,
221223
params?: LocationParameters,
222224
): Promise<Region> {
223-
return timeout(500, timeoutMs, () => this.find(templateImage, params), {signal: params?.abort});
225+
return timeout(updateInterval, timeoutMs, () => this.find(templateImage, params), {signal: params?.abort});
224226
}
225227

226228
/**

0 commit comments

Comments
 (0)