Skip to content

Commit

Permalink
updated 新字段添加
Browse files Browse the repository at this point in the history
  • Loading branch information
zhenghaole committed Aug 1, 2024
1 parent 9d27cc0 commit 9262da2
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 3 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ let info = await browser.getInfo();
"clientHeight":640, // 浏览器可视区域高度
"device": "PC", // 设备类型
"devicePixelRatio":1, // 设备分辨率比
"deviceMemory":8, // 设备大致内存大小
"architecture": "x86", // 芯片架构
"bitness": 64, // CPU架构位数
"gpu": "Google", // GPU厂商
Expand Down
2 changes: 1 addition & 1 deletion dist/browser.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/browser.min.mjs

Large diffs are not rendered by default.

8 changes: 8 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
"browserVersion": "",
"device": "",
"devicePixelRatio":"",
"deviceMemory":"",
"engine": "",
"gpu": "",
"gpuModel": "",
Expand Down Expand Up @@ -153,6 +154,13 @@
</td>
<td>${info.devicePixelRatio}</td>
</tr>
<tr>
<td class="th">
<p class="title">设备内存</p>
<p class="subtitle">Device Memory</p>
</td>
<td>${info.deviceMemory}</td>
</tr>
<tr>
<td class="th">
<p class="title">图形处理器</p>
Expand Down
4 changes: 3 additions & 1 deletion src/module/device-loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,10 @@ export default {
},
async getInfo(){
let devicePixelRatio = globalThis?.devicePixelRatio||1;
let deviceMemory = globalThis?.navigator?.deviceMemory||4;
return Object.assign({
devicePixelRatio
devicePixelRatio,
deviceMemory
},this.parse());
}
}

0 comments on commit 9262da2

Please sign in to comment.