Constructor

PrecacheController

new PrecacheController(cacheName)

Create a new PrecacheController.

Parameter

cacheName

string

Methods

addToCacheList

addToCacheList(entries)

This method will add items to the precache list, removing duplicates and ensuring the information is valid.

Parameter

entries

Array of (module:workbox-precaching.PrecacheController.PrecacheEntry or string)

Array of entries to precache.

cleanup

async

cleanup() returns Promise containing module:workbox-precaching.PrecacheController.CleanupResult

Compare the URLs and determines which assets are no longer required in the cache.

This should be called in the service worker activate event.

Returns

Promise containing module:workbox-precaching.PrecacheController.CleanupResult Resolves with an object containing details of the deleted cache requests and precache revision details.

getCachedUrls

getCachedUrls() returns Array of string

Returns an array of fully qualified URL's that will be precached.

Returns

Array of string An array of URLs.

install

async

install(options) returns Promise containing module:workbox-precaching.PrecacheController.InstallResult

Call this method from a service work install event to start precaching assets.

Parameter

options

Object

Values in options have the following properties:

Parameter

suppressWarnings

boolean

Suppress warning messages.

plugins

Array of Object

Plugins to be used for fetching and caching during install.

Returns

Promise containing module:workbox-precaching.PrecacheController.InstallResult