diff options
author | Dan Finlay <dan@danfinlay.com> | 2016-06-22 04:18:32 +0800 |
---|---|---|
committer | Dan Finlay <dan@danfinlay.com> | 2016-06-22 04:18:32 +0800 |
commit | a08c3bc01b11fbd0e3a243359befbe9fc909edf4 (patch) | |
tree | b79b7324139945c429ca4b6c74715d8040fdf4e1 /app/scripts/lib/port-stream.js | |
parent | f7f8f8b1c50be39db22a7b10c6c6db007fe590aa (diff) | |
download | tangerine-wallet-browser-a08c3bc01b11fbd0e3a243359befbe9fc909edf4.tar.gz tangerine-wallet-browser-a08c3bc01b11fbd0e3a243359befbe9fc909edf4.tar.zst tangerine-wallet-browser-a08c3bc01b11fbd0e3a243359befbe9fc909edf4.zip |
Auto linted
Diffstat (limited to 'app/scripts/lib/port-stream.js')
-rw-r--r-- | app/scripts/lib/port-stream.js | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/app/scripts/lib/port-stream.js b/app/scripts/lib/port-stream.js index 2644741fc..1889e3c04 100644 --- a/app/scripts/lib/port-stream.js +++ b/app/scripts/lib/port-stream.js @@ -3,10 +3,9 @@ const inherits = require('util').inherits module.exports = PortDuplexStream - inherits(PortDuplexStream, Duplex) -function PortDuplexStream(port){ +function PortDuplexStream (port) { Duplex.call(this, { objectMode: true, }) @@ -17,7 +16,7 @@ function PortDuplexStream(port){ // private -PortDuplexStream.prototype._onMessage = function(msg){ +PortDuplexStream.prototype._onMessage = function (msg) { if (Buffer.isBuffer(msg)) { delete msg._isBuffer var data = new Buffer(msg) @@ -29,11 +28,11 @@ PortDuplexStream.prototype._onMessage = function(msg){ } } -PortDuplexStream.prototype._onDisconnect = function(){ +PortDuplexStream.prototype._onDisconnect = function () { try { // this.end() this.emit('close') - } catch(err){ + } catch (err) { this.emit('error', err) } } @@ -42,7 +41,7 @@ PortDuplexStream.prototype._onDisconnect = function(){ PortDuplexStream.prototype._read = noop -PortDuplexStream.prototype._write = function(msg, encoding, cb){ +PortDuplexStream.prototype._write = function (msg, encoding, cb) { try { if (Buffer.isBuffer(msg)) { var data = msg.toJSON() @@ -54,7 +53,7 @@ PortDuplexStream.prototype._write = function(msg, encoding, cb){ this._port.postMessage(msg) } cb() - } catch(err){ + } catch (err) { console.error(err) // this.emit('error', err) cb(new Error('PortDuplexStream - disconnected')) @@ -63,4 +62,4 @@ PortDuplexStream.prototype._write = function(msg, encoding, cb){ // util -function noop(){}
\ No newline at end of file +function noop () {} |