Skip to content

(#312) Added new parameter updateInterval to waitFor to make the … #333

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 7, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion lib/screen.class.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<typeof ScreenClass.prototype.find>,
timeoutMs: number = 5000,
updateInterval: number = 500,
params?: LocationParameters,
): Promise<Region> {
return timeout(500, timeoutMs, () => this.find(templateImage, params), {signal: params?.abort});
return timeout(updateInterval, timeoutMs, () => this.find(templateImage, params), {signal: params?.abort});
}

/**
Expand Down