qidian-shared 1.1.3 → 1.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -13,8 +13,8 @@ const platformInfo = {
13
13
  supporterVs: "",
14
14
  webp: true
15
15
  };
16
- const navigator = window.navigator;
17
- const ua = navigator.userAgent.toLowerCase();
16
+ const navigator = typeof window === "undefined" ? void 0 : window.navigator;
17
+ const ua = navigator?.userAgent.toLowerCase() || "";
18
18
  const testUa = (regexp) => regexp.test(ua);
19
19
  const testVs = (regexp) => {
20
20
  let res = ua.match(regexp) || "";
@@ -40,7 +40,7 @@ function getPlatformInfo() {
40
40
  return platformInfo;
41
41
  }
42
42
  function getNetworkType() {
43
- let type = navigator.connection?.type || navigator.connection?.effectiveType;
43
+ let type = navigator?.connection?.type || navigator?.connection?.effectiveType;
44
44
  if (type) type = type.toUpperCase();
45
45
  else type = "unknow";
46
46
  return type;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "qidian-shared",
3
- "version": "1.1.3",
3
+ "version": "1.1.4",
4
4
  "description": "QiDian 共享工具函数和钩子",
5
5
  "type": "module",
6
6
  "author": "qidian",