W3cubDocs

/Haxe JavaScript

FetchEvent

package js.html

extends ExtendableEventEvent

@:native("FetchEvent") Available on js

The parameter passed into the ServiceWorkerGlobalScope.onfetch handler, FetchEvent represents a fetch action that is dispatched on the ServiceWorkerGlobalScope of a ServiceWorker. It contains information about the request and resulting response, and provides the FetchEvent.respondWith() method, which allows us to provide an arbitrary response back to the controlled page.

Documentation FetchEvent by Mozilla Contributors, licensed under CC-BY-SA 2.5.

See:

Constructor

new (type:String, eventInitDict:FetchEventInit)

Throws:

null DOMError

Variables

read only clientId:String

Returns the id of the client that the current service worker is controlling.

read only isReload:Bool

Returns a Boolean that is true if the event was dispatched with the user's intention for the page to reload, and false otherwise. Typically, pressing the refresh button in a browser is a reload, while clicking a link and pressing the back button is not.

read only request:Request

Returns the Request that triggered the event handler.

Methods

respondWith (r:Promise<Response>):Void

Throws:

null DOMError

© 2005–2018 Haxe Foundation
Licensed under a MIT license.
https://api.haxe.org/js/html/FetchEvent.html