Merge pull request #10681 from CodeDaraW/fix-electron
fix: electron enviroment detection
This commit is contained in:
commit
cf1acd3eaf
@ -15,9 +15,10 @@
|
|||||||
/* globals module, process */
|
/* globals module, process */
|
||||||
|
|
||||||
module.exports = function isNodeJS() {
|
module.exports = function isNodeJS() {
|
||||||
// NW.js is a browser context, but copies some Node.js objects; see
|
// NW.js / Electron is a browser context, but copies some Node.js objects; see
|
||||||
// http://docs.nwjs.io/en/latest/For%20Users/Advanced/JavaScript%20Contexts%20in%20NW.js/#access-nodejs-and-nwjs-api-in-browser-context
|
// http://docs.nwjs.io/en/latest/For%20Users/Advanced/JavaScript%20Contexts%20in%20NW.js/#access-nodejs-and-nwjs-api-in-browser-context
|
||||||
|
// https://electronjs.org/docs/api/process#processversionselectron
|
||||||
return typeof process === 'object' &&
|
return typeof process === 'object' &&
|
||||||
process + '' === '[object process]' &&
|
process + '' === '[object process]' &&
|
||||||
!process.versions['nw'];
|
!process.versions['nw'] && !process.versions['electron'];
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user