INNER CODE UNIT · JavaScript

Fortress

tiliondev/fortress · sdk/node/index.js:117

export class Fortress {
  constructor({ port = 9222, persona = null, extraArgs = [], headless = true, channel = DEFAULT_CHANNEL } = {}) {
    if (!CHANNELS[channel]) throw new Error(`unknown channel '${channel}'; use one of ${Object.keys(CHANNELS)}`);
    const { tag, docker } = CHANNELS[channel];
    Object.assign(this, { port, persona, extraArgs, headless, channel, tag, docker, host: hostFor(tag),
                          proc: null, dockerName: null, cdpUrl: null });
  }
  static async launch(opts) { return new Fortress(opts).start(); }

  async start() {
    const plat = resolvePlatform();
    const native = plat && (plat === "linux-x64" || await assetExists(plat, this.host));
    if (native) await this._startNative(plat); else this._startDocker();
    this.cdpUrl = await waitCdp(this.port);
    return this;
  }

  async _startNative(plat) {

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…