2016-01-15 03:26:54 +01:00
|
|
|
const injectCss = require('inject-css')
|
2016-09-13 08:28:07 +02:00
|
|
|
const MetaMaskUiCss = require('../../ui/css')
|
|
|
|
const startPopup = require('./popup-core')
|
2016-09-13 09:31:04 +02:00
|
|
|
const PortStream = require('./lib/port-stream.js')
|
2016-08-17 01:46:44 +02:00
|
|
|
const isPopupOrNotification = require('./lib/is-popup-or-notification')
|
2016-07-21 19:45:32 +02:00
|
|
|
const extension = require('./lib/extension')
|
2016-08-24 00:44:50 +02:00
|
|
|
const notification = require('./lib/notifications')
|
2016-01-15 03:26:54 +01:00
|
|
|
|
|
|
|
var css = MetaMaskUiCss()
|
|
|
|
injectCss(css)
|
|
|
|
|
2016-09-13 08:28:07 +02:00
|
|
|
var name = isPopupOrNotification()
|
|
|
|
closePopupIfOpen(name)
|
|
|
|
window.METAMASK_UI_TYPE = name
|
2016-02-13 05:01:48 +01:00
|
|
|
|
2016-09-13 08:28:07 +02:00
|
|
|
var pluginPort = extension.runtime.connect({ name })
|
|
|
|
var portStream = new PortStream(pluginPort)
|
2016-01-15 11:03:42 +01:00
|
|
|
|
2016-09-13 08:28:07 +02:00
|
|
|
startPopup(portStream)
|
2016-08-17 01:46:44 +02:00
|
|
|
|
2016-08-24 00:44:50 +02:00
|
|
|
function closePopupIfOpen(name) {
|
|
|
|
if (name !== 'notification') {
|
|
|
|
notification.closePopup()
|
|
|
|
}
|
|
|
|
}
|