chrome-remote-interface
Advanced tools
Comparing version 0.17.1 to 0.18.0
@@ -17,2 +17,5 @@ 'use strict'; | ||
// options | ||
const defaultChooseTab = function (tabs) { | ||
return tabs.findIndex((tab) => !!tab.webSocketDebuggerUrl); | ||
}; | ||
options = options || {}; | ||
@@ -23,3 +26,3 @@ this.host = options.host || defaults.HOST; | ||
this.remote = !!(options.remote); | ||
this.tab = options.tab || options.chooseTab || function () { return 0; }; | ||
this.tab = options.tab || options.chooseTab || defaultChooseTab; | ||
// locals | ||
@@ -187,4 +190,3 @@ EventEmitter.call(this); | ||
try { | ||
// disable the permessage-deflate as a temporary fix for #39 | ||
chrome._ws = new WebSocket(url, {'perMessageDeflate': false}); | ||
chrome._ws = new WebSocket(url); | ||
} catch (err) { | ||
@@ -191,0 +193,0 @@ // handles bad URLs |
@@ -12,3 +12,3 @@ { | ||
"homepage": "https://github.com/cyrus-and/chrome-remote-interface", | ||
"version": "0.17.1", | ||
"version": "0.18.0", | ||
"repository": { | ||
@@ -25,3 +25,3 @@ "type": "git", | ||
"dependencies": { | ||
"ws": "1.1.x", | ||
"ws": "2.0.x", | ||
"commander": "2.1.x" | ||
@@ -28,0 +28,0 @@ }, |
@@ -38,13 +38,16 @@ chrome-remote-interface [![Build Status](https://travis-ci.org/cyrus-and/chrome-remote-interface.svg?branch=master)](https://travis-ci.org/cyrus-and/chrome-remote-interface) | ||
}).catch((err) => { | ||
console.error(`ERROR: ${err.message}`); | ||
console.error(err); | ||
client.close(); | ||
}); | ||
}).on('error', (err) => { | ||
console.error('Cannot connect to remote endpoint:', err); | ||
// cannot connect to the remote endpoint | ||
console.error(err); | ||
}); | ||
``` | ||
Find more examples in the [wiki]. | ||
Find more examples in the [wiki], in particular notice how the above can be | ||
rewritten using the [`async`/`await`][async-await-example] primitives. | ||
[wiki]: https://github.com/cyrus-and/chrome-remote-interface/wiki | ||
[async-await-example]: https://github.com/cyrus-and/chrome-remote-interface/wiki/Async-await-example | ||
@@ -108,2 +111,14 @@ Installation | ||
##### Headless | ||
Since version 57, additionally use the `--headless` option, for example: | ||
google-chrome --headless --remote-debugging-port=9222 | ||
Please note that currently the *DevTools* methods are not properly supported in | ||
headless mode; use the [Target domain] instead. See [#84] for more information. | ||
[#84]: https://github.com/cyrus-and/chrome-remote-interface/issues/84 | ||
[Target domain]: https://chromedevtools.github.io/debugger-protocol-viewer/tot/Target/ | ||
#### Android | ||
@@ -431,4 +446,5 @@ | ||
Defaults to a function which returns the currently active tab (`function | ||
(tabs) { return 0; }`); | ||
Defaults to a function which returns the first available tab starting from the | ||
currently active one (note that at most one connection can be established to | ||
the same tab); | ||
- `protocol`: [Chrome Debugging Protocol] descriptor object. Defaults to use the | ||
@@ -435,0 +451,0 @@ protocol chosen according to the `remote` option; |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
897233
14477
831
+ Addedultron@1.1.1(transitive)
+ Addedws@2.0.3(transitive)
- Removedoptions@0.0.6(transitive)
- Removedultron@1.0.2(transitive)
- Removedws@1.1.5(transitive)
Updatedws@2.0.x