How to use the chrome-remote-interface.createClient function in chrome-remote-interface

To help you get started, we’ve selected a few chrome-remote-interface 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 sidorares / crconsole / index.js View on Github external
connect: function(options, cb) {
    var self = this;
    self.options = options;
    var client = chrome.createClient();
    client.on("error", function(error) {
      console.log(error);
    });
    self.client = client;
    if (options.websocket) {
      return cb(null, {
        url: '',
        webSocketDebuggerUrl: options.websocket
      });
    } else {
      client.listTabs(options.host, options.port, function(err, tabs) {
        if(err) return cb(err);
        // TODO: skip tabs without webSocketDebuggerUrl (likely already being debugged)
        cb(null, tabs[0]);
      });
    }