How to use @loki/target-chrome-core - 2 common examples

To help you get started, we’ve selected a few @loki/target-chrome-core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github oblador / loki / packages / target-chrome-app / src / create-chrome-app-target.js View on Github external
async function createNewDebuggerInstance() {
    const { port } = instance;
    debug(`Launching new tab with debugger at port ${port}`);
    const target = await CDP.New({ port });
    debug(`Launched with target id ${target.id}`);
    const client = await CDP({ port, target });

    client.close = () => {
      debug('New closing tab');
      return CDP.Close({ port, id: target.id });
    };

    return client;
  }

  return createChromeTarget(start, stop, createNewDebuggerInstance, baseUrl);
}
github oblador / loki / packages / target-chrome-docker / src / create-chrome-docker-target.js View on Github external
client.close = () => {
      debug('New closing tab');
      return CDP.Close({ host, port, id: target.id });
    };

    return client;
  }

  process.on('SIGINT', () => {
    if (dockerId) {
      const maybeSudo = dockerWithSudo ? 'sudo ' : '';
      execSync(`${maybeSudo}${dockerPath} kill ${dockerId}`);
    }
  });

  return createChromeTarget(
    start,
    stop,
    createNewDebuggerInstance,
    dockerUrl,
    ensureImageDownloaded
  );
}

@loki/target-chrome-core

Loki Chrome target core lib

MIT
Latest version published 9 months ago

Package Health Score

65 / 100
Full package analysis

Popular @loki/target-chrome-core functions