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.
42 lines
1.2 KiB
42 lines
1.2 KiB
8 years ago
|
const injectCss = require('inject-css')
|
||
8 years ago
|
const SWcontroller = require('client-sw-ready-event/lib/sw-client.js')
|
||
|
const SwStream = require('sw-stream/lib/sw-stream.js')
|
||
8 years ago
|
const MetaMaskUiCss = require('../../ui/css')
|
||
8 years ago
|
const setupIframe = require('./lib/setup-iframe.js')
|
||
8 years ago
|
const MetamaskInpageProvider = require('../../app/scripts/lib/inpage-provider.js')
|
||
8 years ago
|
const MetamascaraPlatform = require('../../app/scripts/platforms/window')
|
||
8 years ago
|
const startPopup = require('../../app/scripts/popup-core')
|
||
8 years ago
|
|
||
8 years ago
|
// create platform global
|
||
|
global.platform = new MetamascaraPlatform()
|
||
|
|
||
|
|
||
8 years ago
|
var css = MetaMaskUiCss()
|
||
|
injectCss(css)
|
||
8 years ago
|
const container = document.getElementById('app-content')
|
||
8 years ago
|
|
||
|
var name = 'popup'
|
||
|
window.METAMASK_UI_TYPE = name
|
||
|
|
||
8 years ago
|
const background = new SWcontroller({
|
||
8 years ago
|
fileName: '/background.js',
|
||
8 years ago
|
})
|
||
8 years ago
|
|
||
|
// Setup listener for when the service worker is read
|
||
8 years ago
|
background.on('ready', (readSw) => {
|
||
8 years ago
|
let connectionStream = SwStream({
|
||
8 years ago
|
serviceWorker: background.controller,
|
||
8 years ago
|
context: name,
|
||
|
})
|
||
|
startPopup({container, connectionStream}, (err, store) => {
|
||
|
if (err) return displayCriticalError(err)
|
||
|
store.subscribe(() => {
|
||
|
const state = store.getState()
|
||
|
if (state.appState.shouldClose) window.close()
|
||
|
})
|
||
8 years ago
|
})
|
||
8 years ago
|
})
|
||
8 years ago
|
|
||
8 years ago
|
background.startWorker()
|
||
8 years ago
|
console.log('hello from MetaMascara ui!')
|