summaryrefslogtreecommitdiff
path: root/common/browser.js
blob: 0ff351015ea8b309d211d26ba756303df0b98290 (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
24
25
/**
 * Myext WebExtension API access normalization
 *
 * Copyright (C) 2021 Wojtek Kosior
 * 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;
    }
})();