Skip to content

Commit 13989d9

Browse files
committed
Compatible with Elecrton renderer process
1 parent 52cc139 commit 13989d9

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

src/proxyClient.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
#endif
1717

1818
#if ENVIRONMENT_MAY_BE_NODE
19-
var ENVIRONMENT_IS_NODE = typeof process == 'object' && typeof process.versions == 'object' && typeof process.versions.node == 'string';
19+
var ENVIRONMENT_IS_NODE = typeof process == 'object' && typeof process.versions == 'object' && typeof process.versions.node == 'string' && process.type != 'renderer';
2020
if (ENVIRONMENT_IS_NODE) {
2121
var NodeWorker = require('worker_threads').Worker;
2222
global.Worker = function(url, options) {

src/shell.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ var ENVIRONMENT_IS_WEB = typeof window == 'object';
9696
var ENVIRONMENT_IS_WORKER = typeof importScripts == 'function';
9797
// N.b. Electron.js environment is simultaneously a NODE-environment, but
9898
// also a web environment.
99-
var ENVIRONMENT_IS_NODE = typeof process == 'object' && typeof process.versions == 'object' && typeof process.versions.node == 'string';
99+
var ENVIRONMENT_IS_NODE = typeof process == 'object' && typeof process.versions == 'object' && typeof process.versions.node == 'string' && process.type != 'renderer';
100100
#if AUDIO_WORKLET
101101
var ENVIRONMENT_IS_SHELL = !ENVIRONMENT_IS_WEB && !ENVIRONMENT_IS_NODE && !ENVIRONMENT_IS_WORKER && !ENVIRONMENT_IS_AUDIO_WORKLET;
102102
#else

src/shell_minimal.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ var readyPromise = new Promise((resolve, reject) => {
4646
#endif
4747

4848
#if ENVIRONMENT_MAY_BE_NODE
49-
var ENVIRONMENT_IS_NODE = typeof process == 'object';
49+
var ENVIRONMENT_IS_NODE = typeof process == 'object' && process.type != 'renderer';
5050
#endif
5151

5252
#if ENVIRONMENT_MAY_BE_SHELL

src/wasm_worker.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
#if ENVIRONMENT_MAY_BE_NODE
88
// Node.js support
9-
var ENVIRONMENT_IS_NODE = typeof process == 'object' && typeof process.versions == 'object' && typeof process.versions.node == 'string';
9+
var ENVIRONMENT_IS_NODE = typeof process == 'object' && typeof process.versions == 'object' && typeof process.versions.node == 'string' && process.type != 'renderer';
1010
if (ENVIRONMENT_IS_NODE) {
1111
// Create as web-worker-like an environment as we can.
1212

0 commit comments

Comments
 (0)