Skip to content

Commit

Permalink
fix: dont log debug info on server
Browse files Browse the repository at this point in the history
  • Loading branch information
streamich committed Feb 13, 2018
1 parent b8900e2 commit 2a8d5aa
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "freestyler",
"version": "1.6.3",
"version": "1.6.4",
"description": "5th generation React styling library",
"main": "lib/index.js",
"module": "modules/index.js",
Expand Down
22 changes: 15 additions & 7 deletions src/debug/index.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,22 @@
import createBroadcaster from './createBroadcaster';
import {sym} from '../util';

const broadcaster = createBroadcaster();
const $$debug = sym('debug');
const channel = process.env.FREESTYLER_PREFIX || 'default';
let broadcaster: any = {
emit: () => {},
};

if (!window[$$debug]) {
window[$$debug] = {};
}
const isClient = typeof window === 'object';

if (isClient) {
broadcaster = createBroadcaster();
const $$debug = sym('debug');
const channel = process.env.FREESTYLER_PREFIX || 'default';

window[$$debug][channel] = broadcaster;
if (!window[$$debug]) {
window[$$debug] = {};
}

window[$$debug][channel] = broadcaster;
}

export const emit = action => broadcaster.emit(action);

0 comments on commit 2a8d5aa

Please sign in to comment.