Movatterモバイル変換


[0]ホーム

URL:


  1. Web
  2. Web APIs
  3. ContentIndexEvent

ContentIndexEvent

Limited availability

This feature is not Baseline because it does not work in some of the most widely-used browsers.

Experimental:This is anexperimental technology
Check theBrowser compatibility table carefully before using this in production.

Note: This feature is only available inService Workers.

TheContentIndexEvent interface of thecontent index defines the object used to represent thecontentdelete event.

This event is sent to theglobal scope of aServiceWorker. It contains the id of the indexed content to be removed.

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

Event ExtendableEvent ContentIndexEvent

Constructor

ContentIndexEvent()Experimental

Creates and returns a newContentIndexEvent object whose type and other options are configured as specified.

Instance properties

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

idRead onlyExperimental

AString which identifies the deleted content index via it'sid.

Instance methods

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

Examples

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

js
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

Specification
Content Index
# content-index-event

Browser compatibility

See also

Help improve MDN

Learn how to contribute

This page was last modified on byMDN contributors.


[8]ページ先頭

©2009-2025 Movatter.jp