@@ -19,7 +19,7 @@ import { CONSTANTS } from './constants';
19
19
20
20
/**
21
21
* Returns navigator.userAgent string or '' if it's not defined.
22
- * @return { string } user agent string
22
+ * @return user agent string
23
23
*/
24
24
export function getUA ( ) : string {
25
25
if (
@@ -35,10 +35,9 @@ export function getUA(): string {
35
35
/**
36
36
* Detect Cordova / PhoneGap / Ionic frameworks on a mobile device.
37
37
*
38
- * Deliberately does not rely on checking `file://` URLs (as this fails PhoneGap in the Ripple emulator) nor
39
- * Cordova `onDeviceReady`, which would normally wait for a callback.
40
- *
41
- * @return {boolean } isMobileCordova
38
+ * Deliberately does not rely on checking `file://` URLs (as this fails PhoneGap
39
+ * in the Ripple emulator) nor Cordova `onDeviceReady`, which would normally
40
+ * wait for a callback.
42
41
*/
43
42
export function isMobileCordova ( ) : boolean {
44
43
return (
@@ -51,9 +50,9 @@ export function isMobileCordova(): boolean {
51
50
/**
52
51
* Detect Node.js.
53
52
*
54
- * @return {boolean } True if Node.js environment is detected.
55
- * Node detection logic from: https://github.com/iliakan/detect-node/
53
+ * @return true if Node.js environment is detected.
56
54
*/
55
+ // Node detection logic from: https://github.com/iliakan/detect-node/
57
56
export function isNode ( ) : boolean {
58
57
try {
59
58
return (
@@ -68,13 +67,13 @@ export function isNode(): boolean {
68
67
* Detect Browser Environment
69
68
*/
70
69
export function isBrowser ( ) : boolean {
71
- return typeof window !== 'undefined' ;
70
+ return typeof self === 'object' && self . self === self ;
72
71
}
73
72
74
73
/**
75
74
* Detect React Native.
76
75
*
77
- * @return { boolean } True if ReactNative environment is detected.
76
+ * @return true if ReactNative environment is detected.
78
77
*/
79
78
export function isReactNative ( ) : boolean {
80
79
return (
@@ -85,7 +84,7 @@ export function isReactNative(): boolean {
85
84
/**
86
85
* Detect whether the current SDK build is the Node version.
87
86
*
88
- * @return { boolean } True if it's the Node SDK build.
87
+ * @return true if it's the Node SDK build.
89
88
*/
90
89
export function isNodeSdk ( ) : boolean {
91
90
return CONSTANTS . NODE_CLIENT === true || CONSTANTS . NODE_ADMIN === true ;
0 commit comments