ContentIndexEvent - Web APIs 编辑

Draft

This page is not complete.

The ContentIndexEvent interface of the Content Index API defines the object used to represent the contentdelete event.

This event is sent to the global scope of a ServiceWorker. It contains the id of the indexed content to be removed.

The contentdelete event is only fired when the deletion happens due to interaction with the browser's built-in user interface. It is not fired when the ContentIndex.delete method is called.

Constructor

ContentIndexEvent()
Creates and returns a new ContentIndexEvent object whose type and other options are configured as specified.

Properties

In addition to the properties listed below, this interface inherits the properties of its parent interface, ExtendableEvent.

id Read only
A String which identifies the deleted content index via it's id.

Methods

While ContentIndexEvent offers no methods of its own, it inherits any specified by its parent interface, ExtendableEvent.

Examples

This example shows the sevice worker script listening for the contentdelete event and logs the removed content index id.

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

SpecificationStatusComment
Content Index API
The definition of 'ContentIndexEvent' in that specification.
Editor's DraftInitial definition.

Browser compatibility

BCD tables only load in the browser

See also

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据

词条统计

浏览:89 次

字数:4214

最后编辑:7年前

编辑次数:0 次

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文