Sha256: aeb59b2fa95bb470d45c6da54b5b5c8caf01170089234895a155413e65645c16

Contents?: true

Size: 1.17 KB

Versions: 35

Compression:

Stored size: 1.17 KB

Contents

'use strict';

const EventEmitter = require('events');

const devtools = require('./lib/devtools');
const Chrome = require('./lib/chrome');

module.exports = function (options, callback) {
    if (typeof options === 'function') {
        callback = options;
        options = undefined;
    }
    const notifier = new EventEmitter();
    if (typeof callback === 'function') {
        // allow to register the error callback later
        process.nextTick(function () {
            new Chrome(options, notifier);
        });
        return notifier.once('connect', callback);
    } else {
        return new Promise(function (fulfill, reject) {
            notifier.once('connect', fulfill);
            notifier.once('error', reject);
            new Chrome(options, notifier);
        });
    }
};

// for backward compatibility
module.exports.listTabs = devtools.List;
module.exports.spawnTab = devtools.New;
module.exports.closeTab = devtools.Close;

module.exports.Protocol = devtools.Protocol;
module.exports.List = devtools.List;
module.exports.New = devtools.New;
module.exports.Activate = devtools.Activate;
module.exports.Close = devtools.Close;
module.exports.Version = devtools.Version;

Version data entries

35 entries across 35 versions & 2 rubygems

Version Path
opal-1.6.1 lib/opal/cli_runners/node_modules/chrome-remote-interface/index.js
opal-1.6.0 lib/opal/cli_runners/node_modules/chrome-remote-interface/index.js
opal-1.6.0.rc1 lib/opal/cli_runners/node_modules/chrome-remote-interface/index.js
opal-1.6.0.alpha1 lib/opal/cli_runners/node_modules/chrome-remote-interface/index.js
opal-1.5.1 lib/opal/cli_runners/node_modules/chrome-remote-interface/index.js
opal-1.5.0 lib/opal/cli_runners/node_modules/chrome-remote-interface/index.js
opal-1.5.0.rc1 lib/opal/cli_runners/node_modules/chrome-remote-interface/index.js
opal-1.4.1 lib/opal/cli_runners/node_modules/chrome-remote-interface/index.js
opal-1.4.0 lib/opal/cli_runners/node_modules/chrome-remote-interface/index.js
opal-1.4.0.alpha1 lib/opal/cli_runners/node_modules/chrome-remote-interface/index.js
opal-1.3.2 lib/opal/cli_runners/node_modules/chrome-remote-interface/index.js
opal-1.3.1 lib/opal/cli_runners/node_modules/chrome-remote-interface/index.js
opal-1.3.0 lib/opal/cli_runners/node_modules/chrome-remote-interface/index.js
opal-1.3.0.rc1 lib/opal/cli_runners/node_modules/chrome-remote-interface/index.js
opal-1.3.0.alpha1 lib/opal/cli_runners/node_modules/chrome-remote-interface/index.js
opal-1.2.0 lib/opal/cli_runners/node_modules/chrome-remote-interface/index.js
opal-1.2.0.beta1 lib/opal/cli_runners/node_modules/chrome-remote-interface/index.js
opal-1.1.1 lib/opal/cli_runners/node_modules/chrome-remote-interface/index.js
opal-1.1.1.rc1 lib/opal/cli_runners/node_modules/chrome-remote-interface/index.js
opal-1.1.0 lib/opal/cli_runners/node_modules/chrome-remote-interface/index.js