1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-11 20:27:12 +01:00
metamask-extension/app/scripts/popup.js

26 lines
708 B
JavaScript
Raw Normal View History

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')
const PortStream = require('./lib/port-stream.js')
2016-08-17 01:46:44 +02:00
const isPopupOrNotification = require('./lib/is-popup-or-notification')
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-11-11 19:26:12 +01:00
function closePopupIfOpen (name) {
2016-08-24 00:44:50 +02:00
if (name !== 'notification') {
notification.closePopup()
}
}