FetchEvent

Overview

This is the event type for fetch events dispatched on the service worker global scope. It contains information about the fetch, including the request and how the receiver will treat the response. It provides the event.respondWith() method, which allows us to provide a response to this fetch.

Location

Required Methods


respondWith

Prevent the browser's default fetch handling, and provide (a promise for) a response yourself.

 

method respondWith: dynamic

 

dynamic respondWith()

 

func respondWith() -> dynamic

 

dynamic respondWith()

 

Function respondWith() As dynamic

waitUntil

Extends the lifetime of the event. Used to notify the browser of tasks that extend beyond the returning of a response, such as streaming and caching.

 

method waitUntil

 

void waitUntil()

 

func waitUntil()

 

void waitUntil()

 

Sub waitUntil()