Socket
Socket
Sign inDemoInstall

chrome-remote-interface

Package Overview
Dependencies
Maintainers
1
Versions
77
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

chrome-remote-interface - npm Package Compare versions

Comparing version 0.4.1 to 0.5.0

44

lib/chrome.js

@@ -9,5 +9,10 @@ var protocol = require('./protocol.json');

var self = this;
self.host = options.host;
self.port = options.port;
self.chooseTab = options.chooseTab;
self.notifier = notifier;
self.callbacks = {};
self.nextCommandId = 1;
addCommandShorthands.call(self);
self.connect(options);
connectToChrome.call(self);
};

@@ -43,21 +48,2 @@

/****************************************************************/
// TODO REUSE object for different host/port (nah?) for different tab (yes!)
/****************************************************************/
Chrome.prototype.connect = function (options, callback) {
var self = this;
self.host = options.host;
self.port = options.port;
self.chooseTab = options.chooseTab;
self.callbacks = {};
self.nextCommandId = 1;
if (callback) {
// TODO close ws
self.notifier.removeAllListeners('connect');
self.notifier.on('connect', callback);
}
connectToChrome.call(self);
};
Chrome.prototype.send = function (method, params, callback) {

@@ -84,2 +70,14 @@ var self = this;

function prepareHelp(type, object, fields) {
var help = {
'type': type
};
fields.forEach(function (field) {
if (field in object) {
help[field] = object[field];
}
});
return help;
}
function addCommand(domainName, command) {

@@ -90,3 +88,4 @@ var self = this;

};
self[domainName][command.name].help = command;
var help = prepareHelp('command', command, ['description', 'parameters']);
self[domainName][command.name].help = help;
}

@@ -99,3 +98,4 @@

};
self[domainName][event.name].help = event;
var help = prepareHelp('event', event, ['parameters']);
self[domainName][event.name].help = help;
}

@@ -102,0 +102,0 @@

@@ -10,3 +10,3 @@ {

"homepage": "https://github.com/cyrus-and/chrome-remote-interface",
"version": "0.4.1",
"version": "0.5.0",
"repository": {

@@ -13,0 +13,0 @@ "type": "git",

@@ -64,12 +64,15 @@ chrome-remote-interface

chrome> Page.navigate.help
{ name: 'navigate',
{ type: 'command',
description: 'Navigates current page to the given URL.',
parameters:
[ { name: 'url',
type: 'string',
description: 'URL to navigate the page to.' } ],
description: 'Navigates current page to the given URL.' }
description: 'URL to navigate the page to.' } ] }
```
For what concerns the types instead, just type its name:
The field `type` determines whether this member is a command or an event.
For what concerns the types instead (they usually start with an upper case
letter), just type its name:
```javascript

@@ -229,2 +232,2 @@ chrome> Network.Timestamp

[1]: https://developers.google.com/chrome-developer-tools/docs/protocol/1.1/
[1]: https://developer.chrome.com/devtools/docs/protocol/1.1/index

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc