You've already forked hotpocket
BTHLABS-50: Safari Web extension
Co-authored-by: Tomek Wójcik <labs@tomekwojcik.pl> Co-committed-by: Tomek Wójcik <labs@tomekwojcik.pl>
This commit is contained in:
34
services/extension/src/common.js
Normal file
34
services/extension/src/common.js
Normal file
@@ -0,0 +1,34 @@
|
||||
const ENV = __HOTPOCKET_EXTENSION_ENV__;
|
||||
const DEBUG = (ENV === 'development') ? true : false;
|
||||
|
||||
const noop = () => {};
|
||||
|
||||
const HotPocketExtension = {
|
||||
platform: null,
|
||||
version: __HOTPOCKET_EXTENSION_VERSION__,
|
||||
debug: DEBUG,
|
||||
api: null,
|
||||
base_url: __HOTPOCKET_EXTENSION_BASE_URL__,
|
||||
LOGGER: {
|
||||
// eslint-disable-next-line no-console
|
||||
debug: (DEBUG === true) ? console.log : noop,
|
||||
error: console.error,
|
||||
info: console.info,
|
||||
warning: console.warn,
|
||||
},
|
||||
configure: ({platform, debug, api}, options) => {
|
||||
options = options || {};
|
||||
|
||||
HotPocketExtension.platform = platform;
|
||||
HotPocketExtension.debug = debug;
|
||||
HotPocketExtension.api = api;
|
||||
|
||||
const background = (options.background === true) ? true : false;
|
||||
|
||||
if (background === false && HotPocketExtension.debug === true) {
|
||||
window.HotPocketExtension = HotPocketExtension;
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
export default HotPocketExtension;
|
||||
Reference in New Issue
Block a user