2
2
* The device platform type
3
3
* @namespace platform
4
4
* @memberof device
5
- * @property { string } ua the user agent string for the current device
6
- * @property { boolean } iOS `true` if the device is an iOS platform
7
- * @property { boolean } android `true` if the device is an Android platform
8
- * @property { boolean } android2 `true` if the device is an Android 2.x platform
9
- * @property { boolean } linux `true` if the device is a Linux platform
10
- * @property { boolean } chromeOS `true` if the device is running on ChromeOS.
11
- * @property { boolean } wp `true` if the device is a Windows Phone platform
12
- * @property { boolean } BlackBerry`true` if the device is a BlackBerry platform
13
- * @property { boolean } Kindle`true` if the device is a Kindle platform
14
- * @property { boolean } ejecta `true` if running under Ejecta
15
- * @property { boolean } isWeixin `true` if running under Wechat
16
- * @property { boolean } nodeJS `true` if running under node.js
17
- * @property { boolean } isMobile `true` if a mobile device
18
- * @property { boolean } webApp `true` if running as a standalone web app
5
+ * ua the user agent string for the current device
6
+ * iOS `true` if the device is an iOS platform
7
+ * android `true` if the device is an Android platform
8
+ * android2 `true` if the device is an Android 2.x platform
9
+ * linux `true` if the device is a Linux platform
10
+ * chromeOS `true` if the device is running on ChromeOS.
11
+ * wp `true` if the device is a Windows Phone platform
12
+ * BlackBerry`true` if the device is a BlackBerry platform
13
+ * Kindle`true` if the device is a Kindle platform
14
+ * ejecta `true` if running under Ejecta
15
+ * isWeixin `true` if running under Wechat
16
+ * nodeJS `true` if running under node.js
17
+ * isMobile `true` if a mobile device
18
+ * webApp `true` if running as a standalone web app
19
19
*/
20
20
21
21
export const ua =
@@ -30,7 +30,7 @@ export const chromeOS = /CrOS/.test(ua);
30
30
export const wp = / W i n d o w s P h o n e / i. test ( ua ) ;
31
31
export const BlackBerry = / B l a c k B e r r y / i. test ( ua ) ;
32
32
export const Kindle = / K i n d l e | S i l k .* M o b i l e S a f a r i / i. test ( ua ) ;
33
- export const ejecta = typeof globalThis . ejecta !== "undefined" ;
33
+ export const ejecta = " ejecta" in globalThis ;
34
34
export const isWeixin = / M i c r o M e s s e n g e r / i. test ( ua ) ;
35
35
export const nodeJS =
36
36
typeof globalThis . process !== "undefined" &&
@@ -40,6 +40,7 @@ export const isMobile =
40
40
/ M o b i / i. test ( ua ) || iOS || android || wp || BlackBerry || Kindle || false ;
41
41
export const webApp =
42
42
( typeof globalThis . navigator !== "undefined" &&
43
+ "standalone" in globalThis . navigator &&
43
44
globalThis . navigator . standalone === true ) ||
44
45
( typeof globalThis . matchMedia !== "undefined" &&
45
46
globalThis . matchMedia ( "(display-mode: standalone)" ) . matches ) ;
0 commit comments