aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorDan <danjm.com@gmail.com>2018-04-21 02:18:44 +0800
committerDan <danjm.com@gmail.com>2018-04-21 02:18:44 +0800
commit3ec22dc7e1676f5679bc33d8b5f314c890e28b8a (patch)
treee30a08f37a710b88ecefee077f6e0e822b1e9758 /app
parent71b0de76ffdbdfc0ae696a009d5ee34971541e0b (diff)
downloadtangerine-wallet-browser-3ec22dc7e1676f5679bc33d8b5f314c890e28b8a.tar
tangerine-wallet-browser-3ec22dc7e1676f5679bc33d8b5f314c890e28b8a.tar.gz
tangerine-wallet-browser-3ec22dc7e1676f5679bc33d8b5f314c890e28b8a.tar.bz2
tangerine-wallet-browser-3ec22dc7e1676f5679bc33d8b5f314c890e28b8a.tar.lz
tangerine-wallet-browser-3ec22dc7e1676f5679bc33d8b5f314c890e28b8a.tar.xz
tangerine-wallet-browser-3ec22dc7e1676f5679bc33d8b5f314c890e28b8a.tar.zst
tangerine-wallet-browser-3ec22dc7e1676f5679bc33d8b5f314c890e28b8a.zip
Notification manager method docs.
Diffstat (limited to 'app')
-rw-r--r--app/scripts/lib/notification-manager.js35
1 files changed, 31 insertions, 4 deletions
diff --git a/app/scripts/lib/notification-manager.js b/app/scripts/lib/notification-manager.js
index ce4825d5b..5dfb42078 100644
--- a/app/scripts/lib/notification-manager.js
+++ b/app/scripts/lib/notification-manager.js
@@ -12,6 +12,11 @@ class NotificationManager {
*
*/
+ /**
+ * Either brings an existing MetaMask notification window into focus, or creates a new notification window. New
+ * notification windows are given a 'popup' type.
+ *
+ */
showPopup () {
this._getPopup((err, popup) => {
if (err) throw err
@@ -32,6 +37,10 @@ class NotificationManager {
})
}
+ /**
+ * Closes a MetaMask notification if it window exists.
+ *
+ */
closePopup () {
// closes notification popup
this._getPopup((err, popup) => {
@@ -41,10 +50,14 @@ class NotificationManager {
})
}
- //
- // Private
- //
-
+ /**
+ * Checks all open MetaMask windows, and returns the first one it finds that is a notification window (i.e. has the
+ * type 'popup')
+ *
+ * @private
+ * @param {Function} cb A node style callback that to whcih the found notification window will be passed.
+ *
+ */
_getPopup (cb) {
this._getWindows((err, windows) => {
if (err) throw err
@@ -52,6 +65,13 @@ class NotificationManager {
})
}
+ /**
+ * Returns all open MetaMask windows.
+ *
+ * @private
+ * @param {Function} cb A node style callback that to which the windows will be passed.
+ *
+ */
_getWindows (cb) {
// Ignore in test environment
if (!extension.windows) {
@@ -63,6 +83,13 @@ class NotificationManager {
})
}
+ /**
+ * Given an array of windows, returns the first that has a 'popup' type, or null if no such window exists.
+ *
+ * @private
+ * @param {array} windows An array of objects containing data about the open MetaMask extension windows.
+ *
+ */
_getPopupIn (windows) {
return windows ? windows.find((win) => {
// Returns notification popup