diff options
author | Dan <danjm.com@gmail.com> | 2018-04-17 01:08:04 +0800 |
---|---|---|
committer | Dan <danjm.com@gmail.com> | 2018-04-17 01:08:04 +0800 |
commit | 20a075657f9c8133b65ea9cf6e8f1f633bc8a8e6 (patch) | |
tree | 2c07e403438905ec0ab758d55b59922fbd8daeba /app/scripts/lib/is-popup-or-notification.js | |
parent | 8fb1237d6425655b88d0bca6ef000d7b77939617 (diff) | |
download | tangerine-wallet-browser-20a075657f9c8133b65ea9cf6e8f1f633bc8a8e6.tar.gz tangerine-wallet-browser-20a075657f9c8133b65ea9cf6e8f1f633bc8a8e6.tar.zst tangerine-wallet-browser-20a075657f9c8133b65ea9cf6e8f1f633bc8a8e6.zip |
Documentation for various controllers and libs
Diffstat (limited to 'app/scripts/lib/is-popup-or-notification.js')
-rw-r--r-- | app/scripts/lib/is-popup-or-notification.js | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/app/scripts/lib/is-popup-or-notification.js b/app/scripts/lib/is-popup-or-notification.js index ad3e825c0..894564def 100644 --- a/app/scripts/lib/is-popup-or-notification.js +++ b/app/scripts/lib/is-popup-or-notification.js @@ -1,8 +1,14 @@ +/** + * Indicates whether the user is viewing the app through an extension like window or through a notification. + * Used to make some style decisions on the frontend, and when deciding whether to close the popup in the backend. + * + * @returns {string} Returns 'popup' if the user is viewing through the browser ('home.html') or popup extension + * ('popup.html'). Otherwise it returns 'notification'. + * + */ module.exports = function isPopupOrNotification () { const url = window.location.href - // if (url.match(/popup.html$/) || url.match(/home.html$/)) { - // Below regexes needed for feature toggles (e.g. see line ~340 in ui/app/app.js) - // Revert below regexes to above commented out regexes before merge to master + if (url.match(/popup.html(?:\?.+)*$/) || url.match(/home.html(?:\?.+)*$/) || url.match(/home.html(?:#.*)*$/)) { return 'popup' |