草案
此页面不完整。
delete()
方法在
ContentIndex
interface unregisters an item from the currently indexed content.
调用
delete()
only affects the index. It does not delete anything from the
缓存
.
ContentIndex.delete(id).then(...);
This method receives no parameters.
返回
Promise
that resolves with
undefined
No exceptions are thrown.
Below is an asynchronous function, that removes an item from the
content index
. We receive a reference to the current
ServiceWorkerRegistration
, which allows us to access the
index
property and thus access the
delete
方法。
async function unregisterContent(article) {
// reference registration
const registration = await navigator.serviceWorker.ready;
// feature detect Content Index
if (!registration.index)
return;
// unregister content from index
await registration.index.delete(article.id);
}
delete
method can also be used within the
service worker
scope.
self.registration.index.delete('my-id');
| 规范 | 状态 | 注释 |
|---|---|---|
|
未知
The definition of 'delete' in that specification. |
未知 | 初始定义。 |
No compatibility data found. Please contribute data for "api.ContentIndex.delete" (depth: 1) to the MDN 兼容性数据存储库 .