summaryrefslogtreecommitdiff
path: root/common/browser.js
blob: e50a121d840e1da86839dccf540e4822639f966f (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
/**
 * Myext WebExtension API access normalization
 *
 * Copyright (C) 2021 Wojtek Kosior
 * Redistribution terms are gathered in the `copyright' file.
 */

/*
 * This module normalizes access to WebExtension apis between
 * chrome-based and firefox-based browsers.
 */

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
 */