aboutsummaryrefslogtreecommitdiffstats
path: root/app/scripts/popup.js
diff options
context:
space:
mode:
Diffstat (limited to 'app/scripts/popup.js')
-rw-r--r--app/scripts/popup.js14
1 files changed, 13 insertions, 1 deletions
diff --git a/app/scripts/popup.js b/app/scripts/popup.js
index 20be15df7..90b90a7af 100644
--- a/app/scripts/popup.js
+++ b/app/scripts/popup.js
@@ -9,7 +9,9 @@ const injectCss = require('inject-css')
const PortStream = require('./lib/port-stream.js')
const StreamProvider = require('web3-stream-provider')
const setupMultiplex = require('./lib/stream-utils.js').setupMultiplex
+const isPopupOrNotification = require('./lib/is-popup-or-notification')
const extension = require('./lib/extension')
+const notification = require('./lib/notifications')
// setup app
var css = MetaMaskUiCss()
@@ -22,7 +24,11 @@ async.parallel({
function connectToAccountManager (cb) {
// setup communication with background
- var pluginPort = extension.runtime.connect({name: 'popup'})
+
+ var name = isPopupOrNotification()
+ closePopupIfOpen(name)
+ window.METAMASK_UI_TYPE = name
+ var pluginPort = extension.runtime.connect({ name })
var portStream = new PortStream(pluginPort)
// setup multiplexing
var mx = setupMultiplex(portStream)
@@ -93,3 +99,9 @@ function setupApp (err, opts) {
networkVersion: opts.networkVersion,
})
}
+
+function closePopupIfOpen(name) {
+ if (name !== 'notification') {
+ notification.closePopup()
+ }
+}