diff options
author | Dan Finlay <dan@danfinlay.com> | 2016-08-23 08:18:14 +0800 |
---|---|---|
committer | Dan Finlay <dan@danfinlay.com> | 2016-08-23 08:18:14 +0800 |
commit | 361e26fad779dc35e480cf5333b6237f437732a5 (patch) | |
tree | 6cf9ad391cb8d60ae0284621eecb8e24cdacd14a /app | |
parent | 642e84da6c6fa03d8848c9e1ecb082949b990b9a (diff) | |
download | tangerine-wallet-browser-361e26fad779dc35e480cf5333b6237f437732a5.tar tangerine-wallet-browser-361e26fad779dc35e480cf5333b6237f437732a5.tar.gz tangerine-wallet-browser-361e26fad779dc35e480cf5333b6237f437732a5.tar.bz2 tangerine-wallet-browser-361e26fad779dc35e480cf5333b6237f437732a5.tar.lz tangerine-wallet-browser-361e26fad779dc35e480cf5333b6237f437732a5.tar.xz tangerine-wallet-browser-361e26fad779dc35e480cf5333b6237f437732a5.tar.zst tangerine-wallet-browser-361e26fad779dc35e480cf5333b6237f437732a5.zip |
Limit to one popup, re-focus on additional notifications.
Diffstat (limited to 'app')
-rw-r--r-- | app/scripts/lib/notifications.js | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/app/scripts/lib/notifications.js b/app/scripts/lib/notifications.js index d33db0ef9..278c7674e 100644 --- a/app/scripts/lib/notifications.js +++ b/app/scripts/lib/notifications.js @@ -21,12 +21,23 @@ function createMsgNotification (state) { } function showNotification() { - extension.windows.create({ - url: 'notification.html', - type: 'detached_panel', - focused: true, - width: 360, - height: 500, + extension.windows.getAll({}, (windows) => { + + let popupWindow = windows.find((win) => { + return win.type === 'popup' + }) + + if (popupWindow) { + return extension.windows.update(popupWindow.id, { focused: true }) + } + + extension.windows.create({ + url: 'notification.html', + type: 'detached_panel', + focused: true, + width: 360, + height: 500, + }) }) } |