workbox-routing. Route
A Route
consists of a pair of callback functions, "match" and "handler".
The "match" callback determine if a route should be used to "handle" a
request by returning a non-falsy value if it can. The "handler" callback
is called when there is a match and should return a Promise that resolves
to a Response
.
Constructor
Route
new Route(match, handler, method)
Constructor for Route class.
Parameter |
|
---|---|
match |
module:workbox-routing~matchCallback A callback function that determines whether the route matches a given
|
handler |
module:workbox-routing~handlerCallback A callback function that returns a Promise resolving to a Response. |
method |
Optional string The HTTP method to match the Route against. |
Method
setCatchHandler
setCatchHandler(handler)
Parameter |
|
---|---|
handler |
module:workbox-routing-handlerCallback A callback function that returns a Promise resolving to a Response |