The FetchEvent() constructor creates a new FetchEvent object.


var fetchEvent = new FetchEvent(type, init);



A DOMString object specifying which event the object represents. This is always fetch for Fetch events.

init Optional

An object conforming to the FetchEventInit dictionary, containing options to apply to the event object. Options are as follows:

clientId Read only

The Client that the current service worker is controlling.

isReload Read only

A boolean value that signifies whether the page was reloaded or not when the event was dispatched. true if yes, and false if not. Typically, pressing the refresh button in a browser is a reload, while clicking a link and pressing the back button is not. If not present, it defaults to false.

preloadResponse Read only

A Promise which returns a previously-loaded response to the client.

replacesClientId Read only

A DOMString which identifies the client which is being replaced by resultingClientId.

resultingClientId Read only

A DOMString containing the new clientId if the client changes as a result of the page load.

request Read only

The Request object that would have triggered the event handler.


Service Workers 1
# dom-fetchevent-fetchevent

Browser compatibility

BCD tables only load in the browser

See also