FetchEvent

This is the event type for fetch events dispatched on the ServiceWorkerGlobalScope.

MDN Reference

Constructors

Link copied to clipboard
constructor(type: EventType<FetchEvent>, init: FetchEventInit)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

The clientId read-only property of the FetchEvent interface returns the id of the Client that the current service worker is controlling.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

The handled property of the FetchEvent interface returns a promise indicating if the event has been handled by the fetch algorithm or not.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

The preloadResponse read-only property of the FetchEvent interface returns a Promise that resolves to the navigation preload Response if navigation preload was triggered, or undefined otherwise.

Link copied to clipboard

The request read-only property of the FetchEvent interface returns the Request that triggered the event handler.

Link copied to clipboard

The resultingClientId read-only property of the FetchEvent interface is the Client.id of the Client that replaces the previous client during a page navigation.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open override val type: EventType<FetchEvent>

Functions

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

The respondWith() method of FetchEvent prevents the browser's default fetch handling, and allows you to provide a promise for a Response yourself.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
fun waitUntil(f: Promise<*>)

The ExtendableEvent.waitUntil() method tells the event dispatcher that work is ongoing.