Skip to content

Commit f04ca31

Browse files
authored
moved env detection
1 parent 6ab949e commit f04ca31

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

index.js

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -120,10 +120,10 @@ class Rectify extends EventEmitter {
120120
var services = app.services = {
121121
app: {
122122
EventEmitter: EventEmitter,
123-
isNode: (typeof process != "undefined" && !process.__nwjs ? 1 : 0),
124-
isFork: (typeof process != "undefined" && process.send ? 1 : 0),
125-
isNWJS: (typeof process != "undefined" && process.__nwjs ? 1 : 0),
126-
isWorker: (typeof WorkerGlobalScope != "undefined" && globalThis instanceof WorkerGlobalScope) ? 1 : 0,
123+
isNode: Rectify.isNode,
124+
isFork: Rectify.isFork,
125+
isNWJS: Rectify.isNWJS,
126+
isWorker: Rectify.isWorker,
127127
window: typeof window == "undefined" ? global : window,
128128
on: function (name, callback) {
129129
if (typeof (callback) == "function") callback = callback.bind(app);
@@ -198,6 +198,11 @@ class Rectify extends EventEmitter {
198198
}
199199
}
200200

201+
Rectify.isNode = (typeof process != "undefined" && !process.__nwjs ? 1 : 0);
202+
Rectify.isFork = (typeof process != "undefined" && process.send ? 1 : 0);
203+
Rectify.isNWJS = (typeof process != "undefined" && process.__nwjs ? 1 : 0);
204+
Rectify.isWorker = (typeof WorkerGlobalScope != "undefined" && globalThis instanceof WorkerGlobalScope) ? 1 : 0;
205+
201206
Rectify.build = function (config, callback) {
202207
var app;
203208
try {

0 commit comments

Comments
 (0)