workbox-runtime-caching

A service worker helper library that implements various runtime caching strategies.

You can learn more about each caching strategy on Jake Archibald's blog post which covers various ways of handling fetch events with a service worker.

These strategies can be used as the handler parameter in the Route constructor or as the handler parameter in workboxSW.router.registerRoute().

Classes

CacheFirst
CacheOnly
Handler
NetworkFirst
NetworkOnly
RequestWrapper
StaleWhileRevalidate

Instance Methods

(static) this.getDefaultCacheName(input) string

The default cache name, used by RequestWrapper when there's no name provided.

It combines a constant prefix with the service worker scope, ensuring that multiple service workers used on the same origin will have different default caches.

Calling this method without any parameters will return workbox-runtime-caching-<service worker scope>.

If you pass in a cacheId, it will be prepended, returning: <cacheid>-workbox-runtime-caching-<service worker scope>.

Parameters
input Object
Properties
cacheId string (Optional)

This will be prepended to the default cache name.

Returns string

Returns the default cache name used based on optional inputs.