Constructor

NetworkFirst

new NetworkFirst(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

string

Plugins to use in conjunction with this caching strategy.

fetchOptions

Object

Values passed along to the init of all fetch() requests made by this strategy.

networkTimeoutSeconds

number

If set, any network requests that fail to respond within the timeout will fallback to the cache.

This option can be used to combat " lie-fi" scenarios.

Method

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