|
|
@ -1,28 +1,35 @@ |
|
|
|
const injectCss = require('inject-css') |
|
|
|
const injectCss = require('inject-css') |
|
|
|
|
|
|
|
const SWcontroller = require('client-sw-ready-event/lib/sw-client.js') |
|
|
|
|
|
|
|
const SwStream = require('sw-stream/lib/sw-stream.js') |
|
|
|
const MetaMaskUiCss = require('../../ui/css') |
|
|
|
const MetaMaskUiCss = require('../../ui/css') |
|
|
|
const setupIframe = require('./lib/setup-iframe.js') |
|
|
|
const setupIframe = require('./lib/setup-iframe.js') |
|
|
|
const MetamaskInpageProvider = require('../../app/scripts/lib/inpage-provider.js') |
|
|
|
const MetamaskInpageProvider = require('../../app/scripts/lib/inpage-provider.js') |
|
|
|
const SWcontroller = require('client-sw-ready-event/lib/sw-client.js') |
|
|
|
|
|
|
|
const SwStream = require('sw-stream/lib/sw-stream.js') |
|
|
|
|
|
|
|
const startPopup = require('../../app/scripts/popup-core') |
|
|
|
const startPopup = require('../../app/scripts/popup-core') |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var css = MetaMaskUiCss() |
|
|
|
var css = MetaMaskUiCss() |
|
|
|
injectCss(css) |
|
|
|
injectCss(css) |
|
|
|
|
|
|
|
const container = document.getElementById('app-content') |
|
|
|
|
|
|
|
|
|
|
|
var name = 'popup' |
|
|
|
var name = 'popup' |
|
|
|
window.METAMASK_UI_TYPE = name |
|
|
|
window.METAMASK_UI_TYPE = name |
|
|
|
|
|
|
|
|
|
|
|
console.log('outside:open') |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const background = new SWcontroller({ |
|
|
|
const background = new SWcontroller({ |
|
|
|
fileName: '/popup/sw-build.js', |
|
|
|
fileName: '/popup/sw-build.js', |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Setup listener for when the service worker is read
|
|
|
|
background.on('ready', (readSw) => { |
|
|
|
background.on('ready', (readSw) => { |
|
|
|
let swStream = SwStream({ |
|
|
|
let connectionStream = SwStream({ |
|
|
|
serviceWorker: background.controller, |
|
|
|
serviceWorker: background.controller, |
|
|
|
|
|
|
|
context: name, |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
startPopup({container, connectionStream}, (err, store) => { |
|
|
|
|
|
|
|
if (err) return displayCriticalError(err) |
|
|
|
|
|
|
|
store.subscribe(() => { |
|
|
|
|
|
|
|
const state = store.getState() |
|
|
|
|
|
|
|
if (state.appState.shouldClose) window.close() |
|
|
|
|
|
|
|
}) |
|
|
|
}) |
|
|
|
}) |
|
|
|
startPopup(swStream) |
|
|
|
|
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
background.startWorker() |
|
|
|
background.startWorker() |
|
|
|