diff options
Diffstat (limited to 'files/zh-cn/web/api/navigator/devicememory/index.html')
-rw-r--r-- | files/zh-cn/web/api/navigator/devicememory/index.html | 41 |
1 files changed, 41 insertions, 0 deletions
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 +--- +<p>{{SeeCompatTable}}{{APIRef("Device Memory")}}</p> + +<p><strong><code>deviceMemory</code></strong> 只读属性返回千兆字节为单位的大概的机器内存。这个值是一个2的次方数除以1024,舍去小数点的近似值。并且,上下边界也用来保护那些拥有非常低端或者高端设备的用户的隐私。</p> + +<h2 id="语法">语法</h2> + +<pre class="syntaxbox notranslate">const <em>memory</em> = navigator.deviceMemory +console.log ("This device has at least " + memory + "GiB of RAM.") +</pre> + +<h3 id="Value">Value</h3> + +<p>一个浮点类型的数,0.25,0.5,1,2,4,8之一.</p> + +<h2 id="Specifications">Specifications</h2> + +<table class="standard-table"> + <tbody> + <tr> + <th scope="col">Specification</th> + <th scope="col">Status</th> + <th scope="col">Comment</th> + </tr> + <tr> + <td>{{SpecName('Device Memory','#sec-device-memory-js-api','deviceMemory')}}</td> + <td>{{Spec2('Device Memory')}}</td> + <td>Initial definition.</td> + </tr> + </tbody> +</table> + +<h2 id="Browser_compatibility">Browser compatibility</h2> + +<div class="hidden">此页上的兼容性表是从结构化数据生成的。如果你想对数据有所贡献,请查看https://github.com/mdn/browser-compat-data并向我们发送请求</div> + +<p>{{Compat("api.Navigator.deviceMemory")}}</p> |