Skip to content

Tego Bot API Documentation v0.2.0


Tego Bot API Documentation / waitForGone

Function: waitForGone()

waitForGone(template, timeout, interval, config?): Promise<boolean>

Defined in: botjs/src/image-match.ts:492

Wait for a template image to disappear from screen

Parameters

template

ImageResource

ImageResource to wait for disappearance

timeout

number = 10000

Maximum time to wait in milliseconds (default: 10000)

interval

number = 500

Time between checks in milliseconds (default: 500)

config?

MatchConfig

Optional matching configuration

Returns

Promise<boolean>

Promise resolving to true if disappeared, false if timeout

Example

typescript
import { imageResource, waitForGone, mouseClick } from "@tego/botjs";

const loadingSpinner = await imageResource("./loading.png");

// Wait up to 30 seconds for loading spinner to disappear
const isGone = await waitForGone(loadingSpinner, 30000, 1000);

if (isGone) {
  console.log("Loading complete!");
} else {
  console.log("Loading took too long");
}

Released under the MIT License.