Constructor

BaseCacheManager

new BaseCacheManager(input)

Constructor for BaseCacheManager

Parameter

input

Object

Values in input have the following properties:

Parameter

cacheName

Optional

String

This is the cache name to store requested assets.

cacheId

Optional

String

The cacheId can be used to ensure that multiple projects sharing http://localhost have unique cache names.

plugins

Optional

Array of Object

Any plugins that should be invoked by the underlying RequestWrapper.

Methods

cleanup

async

cleanup() returns Promise

Compare the URL's and determines which assets are no longer required in the cache.

This should be called in the service worker activate event.

Returns

Promise Promise that resolves once the cache entries have been cleaned.

getCachedUrls

getCachedUrls() returns Array of String

Returns an array of fully qualified URL's that will be cached by this cache manager.

Returns

Array of String An array of URLs that will be cached.

getCacheName

getCacheName() returns String

Gives access to the cache name used by this caching manager.

Returns

String The cache name used by this manager.

install

async

install() returns Promise containing Array of Object

This method will go through each asset added to the cache list and fetch and update the cache for assets which have a new revision hash.

Returns

Promise containing Array of Object The promise resolves when all the desired assets are cached and up -to-date.