1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00
metamask-extension/app/scripts/responsive.js

31 lines
1006 B
JavaScript
Raw Normal View History

2017-07-04 01:09:17 +02:00
const injectCss = require('inject-css')
2017-07-04 00:39:25 +02:00
const startPopup = require('./responsive-core')
2017-07-04 01:09:17 +02:00
const MetaMaskUiCss = require('../../ui/responsive/css')
2017-07-03 22:48:18 +02:00
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
}