aboutsummaryrefslogtreecommitdiffstats
path: root/app/scripts/lib/notifications.js
diff options
context:
space:
mode:
authorkumavis <kumavis@users.noreply.github.com>2017-06-13 04:27:04 +0800
committerGitHub <noreply@github.com>2017-06-13 04:27:04 +0800
commit27220b7bcd5ea1ebdae3bc1b494d28d9c828918c (patch)
treec9385fba3d742ca9cbfb9f3b4c6c9ef29c4f4a1b /app/scripts/lib/notifications.js
parent57d1a1f1860e50837104a10b7b9f86d398c795ec (diff)
parent8af41f1b0539e70cf4c6e1f4a9f4b10ad13656fc (diff)
downloadtangerine-wallet-browser-27220b7bcd5ea1ebdae3bc1b494d28d9c828918c.tar
tangerine-wallet-browser-27220b7bcd5ea1ebdae3bc1b494d28d9c828918c.tar.gz
tangerine-wallet-browser-27220b7bcd5ea1ebdae3bc1b494d28d9c828918c.tar.bz2
tangerine-wallet-browser-27220b7bcd5ea1ebdae3bc1b494d28d9c828918c.tar.lz
tangerine-wallet-browser-27220b7bcd5ea1ebdae3bc1b494d28d9c828918c.tar.xz
tangerine-wallet-browser-27220b7bcd5ea1ebdae3bc1b494d28d9c828918c.tar.zst
tangerine-wallet-browser-27220b7bcd5ea1ebdae3bc1b494d28d9c828918c.zip
Merge branch 'master' into i#1203MainNetSwitch
Diffstat (limited to 'app/scripts/lib/notifications.js')
-rw-r--r--app/scripts/lib/notifications.js65
1 files changed, 0 insertions, 65 deletions
diff --git a/app/scripts/lib/notifications.js b/app/scripts/lib/notifications.js
deleted file mode 100644
index 3db1ac6b5..000000000
--- a/app/scripts/lib/notifications.js
+++ /dev/null
@@ -1,65 +0,0 @@
-const extension = require('./extension')
-const height = 520
-const width = 360
-
-const notifications = {
- show,
- getPopup,
- closePopup,
-}
-module.exports = notifications
-window.METAMASK_NOTIFIER = notifications
-
-function show () {
- getPopup((err, popup) => {
- if (err) throw err
-
- if (popup) {
- // bring focus to existing popup
- extension.windows.update(popup.id, { focused: true })
- } else {
- // create new popup
- extension.windows.create({
- url: 'notification.html',
- type: 'popup',
- focused: true,
- width,
- height,
- })
- }
- })
-}
-
-function getWindows (cb) {
- // Ignore in test environment
- if (!extension.windows) {
- return cb()
- }
-
- extension.windows.getAll({}, (windows) => {
- cb(null, windows)
- })
-}
-
-function getPopup (cb) {
- getWindows((err, windows) => {
- if (err) throw err
- cb(null, getPopupIn(windows))
- })
-}
-
-function getPopupIn (windows) {
- return windows ? windows.find((win) => {
- return (win && win.type === 'popup' &&
- win.height === height &&
- win.width === width)
- }) : null
-}
-
-function closePopup () {
- getPopup((err, popup) => {
- if (err) throw err
- if (!popup) return
- extension.windows.remove(popup.id, console.error)
- })
-}