It's a wrap for Chrome Dev Summit 2020! Watch all the sessions at goo.gle/cds20-sessions now!

Class: PrecacheRoute

Constructor

PrecacheRoute

new PrecacheRoute(precacheController, options)

Parameter

precacheController

PrecacheController

A PrecacheController instance used to both match requests and respond to fetch events.

options

Optional

Object

Options to control how requests are matched against the list of precached URLs.

Values in options have the following properties:

Parameter

directoryIndex

Optional

string

The directoryIndex will check cache entries for a URLs ending with '/' to see if there is a hit when appending the directoryIndex value.

ignoreURLParametersMatching

Optional

Array of RegExp

An array of regex's to remove search params when looking for a cache match.

cleanURLs

Optional

boolean

The cleanURLs option will check the cache for the URL with a .html added to the end of the end.

urlManipulation

Optional

module:workbox-precaching~urlManipulation

This is a function that should take a URL and return an array of alternative URLs that should be checked for precache matches.

Extends
module:workbox-routing.Route

Method

setCatchHandler

setCatchHandler(handler)

Parameter

handler

A callback function that returns a Promise resolving to a Response

Inherited from
module:workbox-routing.Route#setCatchHandler