aboutsummaryrefslogtreecommitdiffstats
path: root/app/scripts/lib/local-message-stream.js
diff options
context:
space:
mode:
authorFrankie <frankie.pangilinan@consensys.net>2016-06-22 06:04:00 +0800
committerFrankie <frankie.pangilinan@consensys.net>2016-06-22 06:04:00 +0800
commitcf663f1104697440121d32cc6db2a8a1d5d54c5a (patch)
tree3ed4b8b9fe8c85f3b3a5bf68482c3fb9967f2de5 /app/scripts/lib/local-message-stream.js
parent265725c6edd62a7f46a9b9cf5a443cf01f0ff00c (diff)
parentdc2ef967028723afe9fe1efd669754723e38a4f0 (diff)
downloadtangerine-wallet-browser-cf663f1104697440121d32cc6db2a8a1d5d54c5a.tar
tangerine-wallet-browser-cf663f1104697440121d32cc6db2a8a1d5d54c5a.tar.gz
tangerine-wallet-browser-cf663f1104697440121d32cc6db2a8a1d5d54c5a.tar.bz2
tangerine-wallet-browser-cf663f1104697440121d32cc6db2a8a1d5d54c5a.tar.lz
tangerine-wallet-browser-cf663f1104697440121d32cc6db2a8a1d5d54c5a.tar.xz
tangerine-wallet-browser-cf663f1104697440121d32cc6db2a8a1d5d54c5a.tar.zst
tangerine-wallet-browser-cf663f1104697440121d32cc6db2a8a1d5d54c5a.zip
Fix conflict
Diffstat (limited to 'app/scripts/lib/local-message-stream.js')
-rw-r--r--app/scripts/lib/local-message-stream.js19
1 files changed, 9 insertions, 10 deletions
diff --git a/app/scripts/lib/local-message-stream.js b/app/scripts/lib/local-message-stream.js
index 76fedd9df..821e51046 100644
--- a/app/scripts/lib/local-message-stream.js
+++ b/app/scripts/lib/local-message-stream.js
@@ -3,10 +3,9 @@ const inherits = require('util').inherits
module.exports = LocalMessageDuplexStream
-
inherits(LocalMessageDuplexStream, Duplex)
-function LocalMessageDuplexStream(opts){
+function LocalMessageDuplexStream (opts) {
Duplex.call(this, {
objectMode: true,
})
@@ -21,19 +20,19 @@ function LocalMessageDuplexStream(opts){
// private
-LocalMessageDuplexStream.prototype._onMessage = function(event){
+LocalMessageDuplexStream.prototype._onMessage = function (event) {
var msg = event.data
// console.log('LocalMessageDuplexStream ('+this._name+') - heard message...', event)
// validate message
- if (event.origin !== location.origin) return //console.log('LocalMessageDuplexStream ('+this._name+') - rejected - (event.origin !== location.origin) ')
- if (typeof msg !== 'object') return //console.log('LocalMessageDuplexStream ('+this._name+') - rejected - (typeof msg !== "object") ')
- if (msg.target !== this._name) return //console.log('LocalMessageDuplexStream ('+this._name+') - rejected - (msg.target !== this._name) ', msg.target, this._name)
- if (!msg.data) return //console.log('LocalMessageDuplexStream ('+this._name+') - rejected - (!msg.data) ')
+ if (event.origin !== location.origin) return // console.log('LocalMessageDuplexStream ('+this._name+') - rejected - (event.origin !== location.origin) ')
+ if (typeof msg !== 'object') return // console.log('LocalMessageDuplexStream ('+this._name+') - rejected - (typeof msg !== "object") ')
+ if (msg.target !== this._name) return // console.log('LocalMessageDuplexStream ('+this._name+') - rejected - (msg.target !== this._name) ', msg.target, this._name)
+ if (!msg.data) return // console.log('LocalMessageDuplexStream ('+this._name+') - rejected - (!msg.data) ')
// console.log('LocalMessageDuplexStream ('+this._name+') - accepted', msg.data)
// forward message
try {
this.push(msg.data)
- } catch(err) {
+ } catch (err) {
this.emit('error', err)
}
}
@@ -42,7 +41,7 @@ LocalMessageDuplexStream.prototype._onMessage = function(event){
LocalMessageDuplexStream.prototype._read = noop
-LocalMessageDuplexStream.prototype._write = function(data, encoding, cb){
+LocalMessageDuplexStream.prototype._write = function (data, encoding, cb) {
// console.log('LocalMessageDuplexStream ('+this._name+') - sending message...')
var message = {
target: this._target,
@@ -54,4 +53,4 @@ LocalMessageDuplexStream.prototype._write = function(data, encoding, cb){
// util
-function noop(){} \ No newline at end of file
+function noop () {}