Project

General

Profile

Download (514 Bytes) Statistics
| Branch: | Tag: | Revision:

haketilo / common / browser.js @ 261548ff

1
/**
2
 * Myext WebExtension API access normalization
3
 *
4
 * Copyright (C) 2021 Wojtek Kosior
5
 * Redistribution terms are gathered in the `copyright' file.
6
 */
7

    
8
/*
9
 * This module normalizes access to WebExtension apis between
10
 * chrome-based and firefox-based browsers.
11
 */
12

    
13
const is_mozilla = typeof window.browser === "object";
14
const is_chrome = !is_mozilla;
15
const browser = window[is_chrome ? "chrome" : "browser"];
16

    
17
/*
18
 * EXPORTS_START
19
 * EXPORT browser
20
 * EXPORT is_chrome
21
 * EXPORT is_mozilla
22
 * EXPORTS_END
23
 */
(1-1/9)