diff options
Diffstat (limited to 'common/browser.js')
-rw-r--r-- | common/browser.js | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/common/browser.js b/common/browser.js index 0ff3510..e50a121 100644 --- a/common/browser.js +++ b/common/browser.js @@ -5,21 +5,19 @@ * Redistribution terms are gathered in the `copyright' file. */ -"use strict"; - /* * This module normalizes access to WebExtension apis between * chrome-based and firefox-based browsers. */ -(() => { - if (typeof browser === "object") { - window.browser = browser; - window.is_chrome = false; - window.is_mozilla = true; - } else { - window.browser = window.chrome; - window.is_chrome = true; - window.is_mozilla = false; - } -})(); +const is_mozilla = typeof window.browser === "object"; +const is_chrome = !is_mozilla; +const browser = window[is_chrome ? "chrome" : "browser"]; + +/* + * EXPORTS_START + * EXPORT browser + * EXPORT is_chrome + * EXPORT is_mozilla + * EXPORTS_END + */ |