Content Index APIservice
The ContentIndexEvent() constructor creates a new ContentIndexEvent object
whose type and other options are configured as specified.
Syntax
new ContentIndexEvent(type, options)
Parameters
type- : A string with the name of the event.
It is case-sensitive and browsers always set it to
contentdelete.
- : A string with the name of the event.
It is case-sensitive and browsers always set it to
options- : An object that, in addition of the properties defined in ExtendableEvent/ExtendableEvent, has the following properties:
id- : The id of the indexed content you want the ContentIndex object to remove.
- : An object that, in addition of the properties defined in ExtendableEvent/ExtendableEvent, has the following properties:
Return value
A new ContentIndexEvent object configured using the given options.
Examples
This examples constructs a new ContentIndexEvent with the relevant id.
const removeData = {
id: "unique-content-id",
};
const ciEvent = new ContentIndexEvent("contentdelete", removeData);
ciEvent.id; // should return 'unique-content-id'
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。离线整理了版式、链接和媒体显示。
