Skip to content
Permalink
Browse files
Fix nwjs support (#569)
  • Loading branch information
miaulightouch authored and Qix- committed Jul 26, 2018
1 parent 05b0ceb commit 207a6a2d53507ec9dd57c94c46cc7d3dd272306d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
@@ -39,7 +39,7 @@ function useColors() {
// NB: In an Electron preload script, document will be defined but not fully
// initialized. Since we know we're in Chrome, we'll just detect this case
// explicitly
if (typeof window !== 'undefined' && window.process && window.process.type === 'renderer') {
if (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) {
return true;
}

@@ -1,9 +1,10 @@
/**
* Detect Electron renderer process, which is node, but we should
* Detect Electron renderer / nwjs process, which is node, but we should
* treat as a browser.
*/

if (typeof process === 'undefined' || process.type === 'renderer' || process.browser === true) {

if (typeof process === 'undefined' || process.type === 'renderer' || process.browser === true || process.__nwjs) {
module.exports = require('./browser.js');
} else {
module.exports = require('./node.js');

0 comments on commit 207a6a2

Please sign in to comment.