You've already forked hotpocket
35 lines
887 B
JavaScript
35 lines
887 B
JavaScript
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: null,
|
|
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;
|