Skip to content

Commit bd9faa1

Browse files
botversethebigredgeek
authored andcommitted
allow colours in workers (#335)
1 parent 501521f commit bd9faa1

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

browser.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,12 @@ function useColors() {
4242
// document is undefined in react-native: https://github.com/facebook/react-native/pull/1632
4343
return (typeof document !== 'undefined' && 'WebkitAppearance' in document.documentElement.style) ||
4444
// is firebug? http://stackoverflow.com/a/398120/376773
45-
(window.console && (console.firebug || (console.exception && console.table))) ||
45+
(typeof window !== 'undefined' && window.console && (console.firebug || (console.exception && console.table))) ||
4646
// is firefox >= v31?
4747
// https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
48-
(navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31);
48+
(navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31) ||
49+
// double check webkit in userAgent just in case we are in a worker
50+
(navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/));
4951
}
5052

5153
/**

0 commit comments

Comments
 (0)