aboutsummaryrefslogtreecommitdiffstats
path: root/library/sw-core.js
diff options
context:
space:
mode:
authorfrankiebee <frankie.diamond@gmail.com>2017-03-22 06:35:01 +0800
committerfrankiebee <frankie.diamond@gmail.com>2017-03-22 06:35:01 +0800
commitd4e8ff188bc82a974fd0a767c2676d4a4b9747b4 (patch)
tree9e092a35d765f2a12e3b60bc2111551b267e0eb8 /library/sw-core.js
parent60f00a950cbe90edda4d9de4a67c3e0c528f6638 (diff)
downloadtangerine-wallet-browser-d4e8ff188bc82a974fd0a767c2676d4a4b9747b4.tar
tangerine-wallet-browser-d4e8ff188bc82a974fd0a767c2676d4a4b9747b4.tar.gz
tangerine-wallet-browser-d4e8ff188bc82a974fd0a767c2676d4a4b9747b4.tar.bz2
tangerine-wallet-browser-d4e8ff188bc82a974fd0a767c2676d4a4b9747b4.tar.lz
tangerine-wallet-browser-d4e8ff188bc82a974fd0a767c2676d4a4b9747b4.tar.xz
tangerine-wallet-browser-d4e8ff188bc82a974fd0a767c2676d4a4b9747b4.tar.zst
tangerine-wallet-browser-d4e8ff188bc82a974fd0a767c2676d4a4b9747b4.zip
WIP:stream
Diffstat (limited to 'library/sw-core.js')
-rw-r--r--library/sw-core.js15
1 files changed, 8 insertions, 7 deletions
diff --git a/library/sw-core.js b/library/sw-core.js
index 1afcc3cff..41fce637f 100644
--- a/library/sw-core.js
+++ b/library/sw-core.js
@@ -4,7 +4,9 @@ const urlUtil = require('url')
const endOfStream = require('end-of-stream')
const asyncQ = require('async-q')
const pipe = require('pump')
-// const ParentStream = require('iframe-stream').ParentStream
+
+const SwGlobalListener = require('sw-stream/lib/sw-global-listener.js')
+const connectionListener = new SwGlobalListener(self)
const setupMultiplex = require('../app/scripts/lib/stream-utils.js').setupMultiplex
const PortStream = require('../app/scripts/lib/port-stream.js')
// const notification = require('../app/scripts/lib/notifications.js')
@@ -148,12 +150,11 @@ function setupController (initState, client) {
/*
need to write a service worker stream for this
*/
- var connectionStream //= new ParentStream()
- SWGlobal.onmessage = (message) => {
- connectRemote(connectionStream, message.origin)
- }
-
- connectRemote(connectionStream, client.origin)
+ // var connectionStream = new ParentStream()
+ connectionListener.on('remote', (portStream, messageEvent) => {
+ debugger
+ connectRemote(connectionStream, messageEvent.origin)
+ })
function connectRemote (connectionStream, originDomain) {
var isMetaMaskInternalProcess = (originDomain === 'http://localhost:9001')