You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
612 B
22 lines
612 B
8 years ago
|
const ParentStream = require('iframe-stream').ParentStream
|
||
8 years ago
|
const SWcontroller = require('client-sw-ready-event/lib/sw-client.js')
|
||
8 years ago
|
const SwStream = require('sw-stream/lib/sw-stream.js')
|
||
|
const SetupUntrustedComunication = ('./lib/setup-untrusted-connection.js')
|
||
8 years ago
|
|
||
8 years ago
|
const background = new SWcontroller({
|
||
8 years ago
|
fileName: '/background.js',
|
||
8 years ago
|
})
|
||
|
|
||
8 years ago
|
const pageStream = new ParentStream()
|
||
8 years ago
|
background.on('ready', (_) => {
|
||
8 years ago
|
let swStream = SwStream({
|
||
|
serviceWorker: background.controller,
|
||
|
context: 'dapp',
|
||
|
})
|
||
8 years ago
|
pageStream.pipe(swStream).pipe(pageStream)
|
||
8 years ago
|
|
||
8 years ago
|
})
|
||
|
|
||
|
background.on('error', console.error)
|
||
|
background.startWorker()
|