mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-22 16:18:08 +02:00
Make the detection of Node.js environments on Electron strict.
The main process and its child processes should be detected as Node.js environments.
This commit is contained in:
parent
7dabc5ecc8
commit
473ea1f1a4
1 changed files with 3 additions and 2 deletions
|
@ -16,11 +16,12 @@
|
|||
|
||||
// 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
|
||||
// https://electronjs.org/docs/api/process#processversionselectron
|
||||
// https://www.electronjs.org/docs/api/process#processversionselectron-readonly
|
||||
// https://www.electronjs.org/docs/api/process#processtype-readonly
|
||||
const isNodeJS =
|
||||
typeof process === "object" &&
|
||||
process + "" === "[object process]" &&
|
||||
!process.versions.nw &&
|
||||
!process.versions.electron;
|
||||
!(process.versions.electron && process.type && process.type !== "browser");
|
||||
|
||||
export { isNodeJS };
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue