Comparing version 2.0.5 to 2.0.6
@@ -274,5 +274,9 @@ (function() { | ||
Client.prototype.openLogcat = function(serial, callback) { | ||
Client.prototype.openLogcat = function(serial, options, callback) { | ||
if (typeof options === 'function') { | ||
callback = options; | ||
options = {}; | ||
} | ||
return this.transport(serial).then(function(transport) { | ||
return new LogcatCommand(transport).execute(); | ||
return new LogcatCommand(transport).execute(options); | ||
}).then(function(stream) { | ||
@@ -279,0 +283,0 @@ return Logcat.readStream(stream, { |
@@ -19,4 +19,12 @@ (function() { | ||
LogcatCommand.prototype.execute = function() { | ||
this._send('shell:logcat -B *:I 2>/dev/null'); | ||
LogcatCommand.prototype.execute = function(options) { | ||
var cmd; | ||
if (options == null) { | ||
options = {}; | ||
} | ||
cmd = 'logcat -B *:I 2>/dev/null'; | ||
if (options.clear) { | ||
cmd = "logcat -c 2>/dev/null && " + cmd; | ||
} | ||
this._send("shell:" + cmd); | ||
return this.parser.readAscii(4).then((function(_this) { | ||
@@ -23,0 +31,0 @@ return function(reply) { |
@@ -25,3 +25,3 @@ (function() { | ||
case Protocol.OKAY: | ||
return new Sync(_this.connection, _this.parser); | ||
return new Sync(_this.connection); | ||
case Protocol.FAIL: | ||
@@ -28,0 +28,0 @@ return _this.parser.readError(); |
@@ -86,3 +86,3 @@ (function() { | ||
tryRead(); | ||
return resolver.promise["finally"]((function(_this) { | ||
return resolver.promise.cancellable()["finally"]((function(_this) { | ||
return function() { | ||
@@ -130,3 +130,3 @@ _this.stream.removeListener('readable', tryRead); | ||
tryRead(); | ||
return resolver.promise["finally"]((function(_this) { | ||
return resolver.promise.cancellable()["finally"]((function(_this) { | ||
return function() { | ||
@@ -173,3 +173,3 @@ _this.stream.removeListener('readable', tryRead); | ||
tryRead(); | ||
return resolver.promise["finally"]((function(_this) { | ||
return resolver.promise.cancellable()["finally"]((function(_this) { | ||
return function() { | ||
@@ -176,0 +176,0 @@ _this.stream.removeListener('readable', tryRead); |
@@ -41,5 +41,5 @@ (function() { | ||
function Sync(connection, parser) { | ||
function Sync(connection) { | ||
this.connection = connection; | ||
this.parser = parser; | ||
this.parser = this.connection.parser; | ||
} | ||
@@ -46,0 +46,0 @@ |
{ | ||
"name": "adbkit", | ||
"version": "2.0.5", | ||
"version": "2.0.6", | ||
"description": "A pure Node.js client for the Android Debug Bridge.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -460,3 +460,3 @@ # adbkit | ||
#### client.openLogcat(serial[, callback]) | ||
#### client.openLogcat(serial[, options][, callback]) | ||
@@ -468,2 +468,4 @@ Calls the `logcat` utility on the device and hands off the connection to [adbkit-logcat][adbkit-logcat], a pure Node.js Logcat client. This is analogous to `adb logcat -B`, but the event stream will be parsed for you and a separate event will be emitted for every log entry, allowing for easy processing. | ||
* **serial** The serial number of the device. Corresponds to the device ID in `client.listDevices()`. | ||
* **options** Optional. The following options are supported: | ||
- **clear** When `true`, clears logcat before opening the reader. Not set by default. | ||
* **callback(err, logcat)** Optional. Use this or the returned `Promise`. | ||
@@ -470,0 +472,0 @@ - **err** `null` when successful, `Error` otherwise. |
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
158853
2939
849