dom / latest / fetchevent / fetchevent.html /

FetchEvent()

The FetchEvent() constructor creates a new FetchEvent object.

Syntax

new FetchEvent(type, init);

Parameters

type

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 Deprecated 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.

Specifications

Browser compatibility

Desktop Mobile
Chrome Edge Firefox Internet Explorer Opera Safari WebView Android Chrome Android Firefox for Android Opera Android Safari on IOS Samsung Internet
FetchEvent
40
17
44
Extended Support Releases (ESR) before Firefox 78 ESR do not support service workers and the Push API.
No
27
11.1
40
40
44
27
11.3
4.0

See also

© 2005–2021 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/FetchEvent/FetchEvent