From 33058f2b292b3a581333bdfb21b8f671898c5060 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:40:17 -0500 Subject: initial commit --- .../web/api/navigator/devicememory/index.html | 41 ++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 files/zh-cn/web/api/navigator/devicememory/index.html (limited to 'files/zh-cn/web/api/navigator/devicememory') diff --git a/files/zh-cn/web/api/navigator/devicememory/index.html b/files/zh-cn/web/api/navigator/devicememory/index.html new file mode 100644 index 0000000000..b5c5948433 --- /dev/null +++ b/files/zh-cn/web/api/navigator/devicememory/index.html @@ -0,0 +1,41 @@ +--- +title: Navigator.deviceMemory +slug: Web/API/Navigator/deviceMemory +translation_of: Web/API/Navigator/deviceMemory +--- +

{{SeeCompatTable}}{{APIRef("Device Memory")}}

+ +

deviceMemory 只读属性返回千兆字节为单位的大概的机器内存。这个值是一个2的次方数除以1024,舍去小数点的近似值。并且,上下边界也用来保护那些拥有非常低端或者高端设备的用户的隐私。

+ +

语法

+ +
const memory = navigator.deviceMemory
+console.log ("This device has at least " + memory + "GiB of RAM.")
+
+ +

Value

+ +

一个浮点类型的数,0.25,0.5,1,2,4,8之一.

+ +

Specifications

+ + + + + + + + + + + + + + +
SpecificationStatusComment
{{SpecName('Device Memory','#sec-device-memory-js-api','deviceMemory')}}{{Spec2('Device Memory')}}Initial definition.
+ +

Browser compatibility

+ + + +

{{Compat("api.Navigator.deviceMemory")}}

-- cgit v1.2.3-54-g00ecf