瀏覽代碼

Add Utils.deviceInfo()

customisations
alemart 1 年之前
父節點
當前提交
9faa9deeff
共有 1 個檔案被更改,包括 16 行新增0 行删除
  1. 16
    0
      src/utils/utils.ts

+ 16
- 0
src/utils/utils.ts 查看文件

@@ -161,4 +161,20 @@ export class Utils
161 161
         // not WebKit
162 162
         return false;
163 163
     }
164
+
165
+    /**
166
+     * Device-specific information for debugging purposes
167
+     */
168
+    static deviceInfo(): string
169
+    {
170
+        return JSON.stringify({
171
+            isIOS: Utils.isIOS(),
172
+            isWebKit: Utils.isWebKit(),
173
+            renderer: Speedy.Platform.renderer,
174
+            vendor: Speedy.Platform.vendor,
175
+            screen: [screen.width, screen.height].toString(),
176
+            userAgent: navigator.userAgent,
177
+            platform: [Utils.platformString(), navigator.platform, navigator.vendor],
178
+        }, null, 4);
179
+    }
164 180
 }

Loading…
取消
儲存