小编tri*_*ixo的帖子

如何在错误中传递变量

嘿嘿

我有以下功能

async function fnIsOnScreenOnce(img, desc,iCounter,client,repeatDelay=0) {
  await timeout(repeatDelay);
  let screenshot= await client.screenshot()

  let buf = new Buffer(screenshot.value, 'base64');
  let img1 = cv.imdecode(buf)
  let result = img1.matchTemplate(img, 5).minMaxLoc(); 
  result.screenshot=img1;
  if (result.maxVal <= 0.65) {
      // Fail
      const msg = "Can't see object yet";
      throw new Error(result);
  }
        // All good
        console.log("result:"+result)
        logger.info("Found image on screen: "+desc);
        return result;
}
Run Code Online (Sandbox Code Playgroud)

函数的调用

function fnIsOnScreen(img,client, repeats = 5, desc, wait = 2000,repeatDelay) {
    logger.info("Looking for image on screen:" +desc +" with " + …
Run Code Online (Sandbox Code Playgroud)

javascript node.js

3
推荐指数
1
解决办法
1352
查看次数

标签 统计

javascript ×1

node.js ×1