aboutsummaryrefslogtreecommitdiffstats
path: root/app/scripts/lib/environment-type.js
blob: f13a1574d191695c91e634d16cdd6dd20bf279a5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
/**
 * Used to determine the window type through which the app is being viewed.
 *  - 'popup' refers to the extension opened through the browser app icon (in top right corner in chrome and firefox)
 *  - 'responsive' refers to the main browser window
 *  - 'notification' refers to the popup that appears in its own window when taking action outside of metamask
 *
 * @returns {string} A single word label that represents the type of window through which the app is being viewed
 *
 */
module.exports = function environmentType () {
  const url = window.location.href
  if (url.match(/popup.html$/)) {
    return 'popup'
  } else if (url.match(/home.html$/)) {
    return 'responsive'
  } else {
    return 'notification'
  }
}