Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return new Promise(async (resolve, reject) => {
try {
screen.config.resourceDirectory = path;
const result = await screen.waitFor(filepath, timeoutMs, {
confidence,
searchRegion: new NutRegion(
left,
top,
width,
height
)
});
resolve({
left: result.left,
top: result.top,
width: result.width,
height: result.height
});
} catch (e) {
return new Promise(async (resolve, reject) => {
try {
screen.config.resourceDirectory = path;
const result = await screen.find(filename, {
confidence,
searchRegion: new NutRegion(
left,
top,
width,
height
)
});
resolve({
left: result.left,
top: result.top,
width: result.width,
height: result.height
});
} catch (e) {