diff options
author | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:40:17 -0500 |
---|---|---|
committer | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:40:17 -0500 |
commit | 33058f2b292b3a581333bdfb21b8f671898c5060 (patch) | |
tree | 51c3e392513ec574331b2d3f85c394445ea803c6 /files/zh-cn/web/api/storagemanager/persisted | |
parent | 8b66d724f7caf0157093fb09cfec8fbd0c6ad50a (diff) | |
download | translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.gz translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.bz2 translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.zip |
initial commit
Diffstat (limited to 'files/zh-cn/web/api/storagemanager/persisted')
-rw-r--r-- | files/zh-cn/web/api/storagemanager/persisted/index.html | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/files/zh-cn/web/api/storagemanager/persisted/index.html b/files/zh-cn/web/api/storagemanager/persisted/index.html new file mode 100644 index 0000000000..0e3c7c4711 --- /dev/null +++ b/files/zh-cn/web/api/storagemanager/persisted/index.html @@ -0,0 +1,53 @@ +--- +title: StorageManager.persisted() +slug: Web/API/StorageManager/persisted +translation_of: Web/API/StorageManager/persisted +--- +<p>{{securecontext_header}}{{APIRef("Storage")}}{{SeeCompatTable}}</p> + +<p><span class="seoSummary"><strong><code>persisted()</code></strong></span>方法是<span class="seoSummary">{{domxref("StorageManager")}}的一个接口,如果盒存储模式(</span><strong>box mode</strong><span class="seoSummary">)的值为 “<strong>persistent</strong>” 则返回一个resolved状态值为<code>true</code>的{{jsxref('Promise')}}。</span></p> + +<h2 id="语法">语法</h2> + +<pre class="syntaxbox">navigator.storage.persisted().then(function(persistent) { ... })</pre> + +<h3 id="参数">参数</h3> + +<p>无</p> + +<h3 id="返回值">返回值</h3> + +<p>一个状态为resolved,值为{{jsxref('Boolean')}}类型的{{jsxref('Promise')}}。</p> + +<h2 id="示例">示例</h2> + +<pre class="brush: js"><code>if (navigator.storage && navigator.storage.persist) + navigator.storage.persisted().then(function(persistent) { + if (persistent) + console.log("Storage will not be cleared except by explicit user action"); + else + console.log("Storage may be cleared by the UA under storage pressure."); + });</code></pre> + +<h2 id="规范">规范</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('Storage','#dom-storagemanager-persisted','persisted')}}</td> + <td>{{Spec2('Storage')}}</td> + <td>Initial definition.</td> + </tr> + </tbody> +</table> + +<h2 id="浏览器兼容性">浏览器兼容性</h2> + + + +<p>{{Compat("api.StorageManager.persisted")}}</p> |