2017-03-29 03:02:08 +02:00
|
|
|
const ParentStream = require('iframe-stream').ParentStream
|
|
|
|
const SWcontroller = require('./sw-controller')
|
|
|
|
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',
|
|
|
|
})
|
|
|
|
|
2017-03-29 20:02:50 +02:00
|
|
|
const pageStream = new ParentStream()
|
2017-03-29 19:53:43 +02:00
|
|
|
background.on('ready', (_) => {
|
2017-03-29 03:02:08 +02:00
|
|
|
// var inpageProvider = new MetamaskInpageProvider(SwStream(background.controller))
|
2017-03-30 00:19:46 +02:00
|
|
|
let swStream = SwStream({
|
|
|
|
serviceWorker: background.controller,
|
|
|
|
context: 'dapp',
|
|
|
|
})
|
2017-03-29 03:02:08 +02:00
|
|
|
pageStream.pipe(swStream).pipe(pageStream)
|
2017-03-30 20:28:22 +02:00
|
|
|
|
2017-03-29 03:02:08 +02:00
|
|
|
})
|
|
|
|
|
|
|
|
background.on('error', console.error)
|
|
|
|
background.startWorker()
|