Browse Source

fix:修正RN内引用报错

adam 3 years ago
parent
commit
2aeed0fa14
1 changed files with 10 additions and 0 deletions
  1. 10
    0
      packages/cts-api/src/meta.ts

+ 10
- 0
packages/cts-api/src/meta.ts View File

1
 export function getMetaData() {
1
 export function getMetaData() {
2
   const nAgt = navigator.userAgent;
2
   const nAgt = navigator.userAgent;
3
+  if (!nAgt) {
4
+    return {
5
+      device: 'app',
6
+      os: 'app',
7
+      os_version: '',
8
+      app: 'WebLiveClient',
9
+      app_version: '',
10
+      tag: {}
11
+    };
12
+  }
3
   let browserName = navigator.appName;
13
   let browserName = navigator.appName;
4
   let fullVersion = `${parseFloat(navigator.appVersion)}`;
14
   let fullVersion = `${parseFloat(navigator.appVersion)}`;
5
   let majorVersion = parseInt(navigator.appVersion, 10);
15
   let majorVersion = parseInt(navigator.appVersion, 10);