diff options
author | kumavis <kumavis@users.noreply.github.com> | 2016-06-22 05:24:28 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-06-22 05:24:28 +0800 |
commit | 537328b5298a42f9d20862d42b9012babcda373c (patch) | |
tree | 9a5728447f5b23a918b4a23c12e91ea1b702e527 /app/scripts/lib/port-stream.js | |
parent | bb7788373d9c234313d651d88c72c18a8e4ca0aa (diff) | |
parent | d7c3e8e9f5182576eb4a990d385ff8ce4ebd417c (diff) | |
download | tangerine-wallet-browser-537328b5298a42f9d20862d42b9012babcda373c.tar tangerine-wallet-browser-537328b5298a42f9d20862d42b9012babcda373c.tar.gz tangerine-wallet-browser-537328b5298a42f9d20862d42b9012babcda373c.tar.bz2 tangerine-wallet-browser-537328b5298a42f9d20862d42b9012babcda373c.tar.lz tangerine-wallet-browser-537328b5298a42f9d20862d42b9012babcda373c.tar.xz tangerine-wallet-browser-537328b5298a42f9d20862d42b9012babcda373c.tar.zst tangerine-wallet-browser-537328b5298a42f9d20862d42b9012babcda373c.zip |
Merge pull request #303 from MetaMask/AutoLint
Auto lint
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 () {} |