File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed
src/SignalR/clients/ts/signalr/src Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -37,23 +37,23 @@ export class Arg {
37
37
export class Platform {
38
38
// react-native has a window but no document so we should check both
39
39
public static get isBrowser ( ) : boolean {
40
- return typeof window === "object" && typeof window . document === "object" ;
40
+ return ! Platform . isNode && typeof window === "object" && typeof window . document === "object" ;
41
41
}
42
42
43
43
// WebWorkers don't have a window object so the isBrowser check would fail
44
44
public static get isWebWorker ( ) : boolean {
45
- return typeof self === "object" && "importScripts" in self ;
45
+ return ! Platform . isNode && typeof self === "object" && "importScripts" in self ;
46
46
}
47
47
48
48
// react-native has a window but no document
49
49
static get isReactNative ( ) : boolean {
50
- return typeof window === "object" && typeof window . document === "undefined" ;
50
+ return ! Platform . isNode && typeof window === "object" && typeof window . document === "undefined" ;
51
51
}
52
52
53
53
// Node apps shouldn't have a window object, but WebWorkers don't either
54
54
// so we need to check for both WebWorker and window
55
55
public static get isNode ( ) : boolean {
56
- return ! this . isBrowser && ! this . isWebWorker && ! this . isReactNative ;
56
+ return typeof process !== "undefined" && process . release && process . release . name === "node" ;
57
57
}
58
58
}
59
59
@@ -295,4 +295,4 @@ export function getGlobalThis(): unknown {
295
295
return global ;
296
296
}
297
297
throw new Error ( "could not find global" ) ;
298
- }
298
+ }
You can’t perform that action at this time.
0 commit comments