aboutsummaryrefslogtreecommitdiffstats
path: root/mascara/src/dapp-connection.js
diff options
context:
space:
mode:
authorfrankiebee <frankie.diamond@gmail.com>2017-04-03 17:08:31 +0800
committerfrankiebee <frankie.diamond@gmail.com>2017-04-03 17:09:03 +0800
commit57655073f6ab4e93b9947302d46a20bd2c7288f1 (patch)
tree3bce06d9ccd8f003cec720b8444d489e1ed6c050 /mascara/src/dapp-connection.js
parent9736e96a93799f081ede01bc7ecd295fa264ffd5 (diff)
downloadtangerine-wallet-browser-57655073f6ab4e93b9947302d46a20bd2c7288f1.tar
tangerine-wallet-browser-57655073f6ab4e93b9947302d46a20bd2c7288f1.tar.gz
tangerine-wallet-browser-57655073f6ab4e93b9947302d46a20bd2c7288f1.tar.bz2
tangerine-wallet-browser-57655073f6ab4e93b9947302d46a20bd2c7288f1.tar.lz
tangerine-wallet-browser-57655073f6ab4e93b9947302d46a20bd2c7288f1.tar.xz
tangerine-wallet-browser-57655073f6ab4e93b9947302d46a20bd2c7288f1.tar.zst
tangerine-wallet-browser-57655073f6ab4e93b9947302d46a20bd2c7288f1.zip
Rename mascara root directory
Diffstat (limited to 'mascara/src/dapp-connection.js')
-rw-r--r--mascara/src/dapp-connection.js21
1 files changed, 21 insertions, 0 deletions
diff --git a/mascara/src/dapp-connection.js b/mascara/src/dapp-connection.js
new file mode 100644
index 000000000..30680c9d7
--- /dev/null
+++ b/mascara/src/dapp-connection.js
@@ -0,0 +1,21 @@
+const ParentStream = require('iframe-stream').ParentStream
+const SWcontroller = require('client-sw-ready-event/lib/sw-client.js')
+const SwStream = require('sw-stream/lib/sw-stream.js')
+const SetupUntrustedComunication = ('./lib/setup-untrusted-connection.js')
+
+const background = new SWcontroller({
+ fileName: '/popup/sw-build.js',
+})
+
+const pageStream = new ParentStream()
+background.on('ready', (_) => {
+ let swStream = SwStream({
+ serviceWorker: background.controller,
+ context: 'dapp',
+ })
+ pageStream.pipe(swStream).pipe(pageStream)
+
+})
+
+background.on('error', console.error)
+background.startWorker()