Constructor

CacheOnly

new CacheOnly(options)

Parameter

options

Object

Values in options have the following properties:

Parameter

cacheName

string

Cache name to store and retrieve requests. Defaults to cache names provided by workbox-core.

plugins

Array of Object

Plugins to use in conjunction with this caching strategy.

Methods

handle

async

handle(input) returns Promise containing Response

This method will perform a request strategy and follows an API that will work with the Workbox Router.

Parameter

input

Object

Values in input have the following properties:

Parameter

event

FetchEvent

The fetch event to run this strategy against.

Returns

Promise containing Response 

makeRequest

async

makeRequest(input) returns Promise containing Response

This method can be used to perform a make a standalone request outside the context of the Workbox Router.

See "Advanced Recipes" for more usage information.

Parameter

input

Object

Values in input have the following properties:

Parameter

request

(Request or string)

Either a Request object, or a string URL, corresponding to the request to be made.

event

Optional

FetchEvent

If provided, event.waitUntil() will be called automatically to extend the service worker's lifetime.

Returns

Promise containing Response