UNPKG

ez-shp-storefront

Version:

A helper function collection for Shopify storefront.

27 lines (26 loc) 591 B
export class Logger { constructor() { this.isEnabled = false; const urlParams = new URLSearchParams(window.location.search); this.isEnabled = !!urlParams.get('debug'); } static getInstance() { if (!this.instance) { this.instance = new Logger(); } return this.instance; } enable() { this.isEnabled = true; } disable() { this.isEnabled = false; } debug(data) { if (!this.isEnabled) { return; } console.log(data); } } Logger.instance = null;