chrome-helper

A helper class for cyrus-and/chrome-remote-interface


Keywords
topmarks, chrome
License
Apache-2.0
Install
npm install chrome-helper@1.0.0

Documentation

ChromeHelper

Build Status Code Climate Test Coverage Issue Count Dependency Status Inline docs npm version

A helper class for cyrus-and/chrome-remote-interface

Primarily designed to reduce repeated code in Topmarks plugins.

Usage

Create a new instance of the ChromeHelper and pass the port and url to the constructor.

var chromeHelper = new ChromeHelper(options.port, options.url);

Use startupChrome() to connect and open a new tab.

Plugin Example

var ChromeHelper = require('chrome-helper');

var samplePlugin = function samplePlugin(app, options) {
  var chromeHelper = new ChromeHelper(options.port, options.url);
  return chromeHelper.startupChrome().then(function (results) {
    // Do some stuff
    return Promise.resolve(results);
  }).then(function () {
    return chromeHelper.shutdownChrome();
  }).catch(console.log);
};

samplePlugin.attributes = {
  name: 'samplePlugin'
};

module.exports = samplePlugin;