Namespace: SpawnDev.SpawnJS.JSObjects
Inherits: ExtendableEvent
Source: JSObjects/ContentIndexEvent.cs
MDN Reference: ContentIndexEvent on MDN
The contentdelete event of the ServiceWorkerGlobalScope interface is fired when an item is removed from the indexed content via the user agent. This event is not cancelable and does not bubble. https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerGlobalScope/contentdelete_event
| Property | Type | Access | Description |
|---|---|---|---|
Id |
string |
get | A string which identifies the deleted content index via it's id. |
SpawnDev.SpawnJS Mapping Note: The JavaScript examples below show the standard Web API usage. In SpawnDev.SpawnJS, the same API is available with C# conventions:
- Properties and methods use PascalCase (e.g.,
readyStatebecomesReadyState)- Events use ActionEvent with
+=/-=(e.g.,addEventListener("click", fn)becomesOnClick += handler)- Async methods return
Task<T>instead ofPromise<T>- Objects should be disposed with
usingstatements- Access via
JS.Get<ContentIndexEvent>(...)or constructornew ContentIndexEvent(...)
self.addEventListener("contentdelete", (event) => {
const deletion = caches
.open("cache-name")
.then((cache) =>
Promise.all([
cache.delete(`/icon/${event.id}`),
cache.delete(`/content/${event.id}`),
]),
);
event.waitUntil(deletion);
});self.oncontentdelete = (event) => {
// …
};