Skip to content

Commit

Permalink
fix(debug): add bug work around (#845)
Browse files Browse the repository at this point in the history
* fix(debug): add bug work around

* fix(debug): lint issues
  • Loading branch information
levithomason authored Nov 13, 2016
1 parent c7474f2 commit 17f64df
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/lib/debug.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,25 @@ let _debug
const noop = () => undefined

if (process.env.NODE_ENV !== 'production' && process.env.NODE_ENV !== 'test') {
// Heads Up!
// https://github.com/visionmedia/debug/pull/331
//
// debug now clears storage on load, grab the debug settings before require('debug').
// We try/catch here as Safari throws on localStorage access in private mode or with cookies disabled.
let DEBUG
try {
DEBUG = window.localStorage.debug
} catch (e) {
/* eslint-disable no-console */
console.warning('Semantic-UI-React could not enable debug.')
console.error(e)
/* eslint-enable no-console */
}

_debug = require('debug')

// enable what ever settings we got from storage
_debug.enable(DEBUG)
} else {
_debug = () => noop
}
Expand Down

0 comments on commit 17f64df

Please sign in to comment.