blob: 0ff42a4cb803ab2fba0de141e54e101db2ab9d99 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
const injectCss = require('inject-css')
const startPopup = require('./responsive-core')
const MetaMaskUiCss = require('../../ui/responsive/css')
const PortStream = require('./lib/port-stream.js')
const ExtensionPlatform = require('./platforms/extension')
const extension = require('extensionizer')
// create platform global
global.platform = new ExtensionPlatform()
// inject css
const css = MetaMaskUiCss()
injectCss(css)
// setup stream to background
const extensionPort = extension.runtime.connect({ name: 'ui' })
const connectionStream = new PortStream(extensionPort)
// start ui
const container = document.getElementById('app-content')
startPopup({ container, connectionStream }, (err, store) => {
if (err) return displayCriticalError(err)
})
function displayCriticalError (err) {
container.innerHTML = '<div class="critical-error">The MetaMask app failed to load: please open and close MetaMask again to restart.</div>'
container.style.height = '80px'
log.error(err.stack)
throw err
}
|