Content Index APIservice
The id read-only property of the
ContentIndexEvent interface is a String which identifies
the deleted content index via its id.
Value
A String representation of the deleted content index id.
Examples
This example listens for the ContentIndexEvent event and logs the removed content index id.
The ContentIndexEvent is only available to the global scope of a ServiceWorker.
self.addEventListener("contentdelete", (event) => {
console.log(event.id);
// logs content index id, which can then be used to determine what content to delete from your cache
});
Specifications
Browser compatibility
See also
- An introductory article on the Content Index API
- Service Worker API, along with information about Cache and CacheStorage
来源:MDN Web Docs / Mozilla 贡献者 · 作者与贡献记录 · CC BY-SA 2.5。离线整理了版式、链接和媒体显示。
