ContentIndexEvent:id 屬性

可用性有限

此特性不是基線特性,因為它在一些最廣泛使用的瀏覽器中不起作用。

實驗性: 這是一項實驗性技術
在生產中使用此技術之前,請仔細檢查瀏覽器相容性表格

注意:此功能僅在 Service Workers 中可用。

ContentIndexEvent 介面的只讀屬性 id 是一個 String,它透過 id 標識被刪除的內容索引。

被刪除的內容索引 ID 的 String 表示。

示例

此示例偵聽 contentdelete 事件並記錄已移除的內容索引 ID。

ContentIndexEvent 僅在 ServiceWorker全域性作用域 中可用。

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
});

規範

規範
Content Index
# dom-contentindexevent-id

瀏覽器相容性

另見