chrome-helper
v1.0.0
Published
A helper class for cyrus-and/chrome-remote-interface
Downloads
21
Readme
ChromeHelper
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;