Properties

cacheNames

static

Get the current cache names used by Workbox.

cacheNames.precache is used for precached assets, cacheNames.googleAnalytics is used by workbox-google-analytics to store analytics.js, and cacheNames.runtime is used for everything else.

Returns

Object An object with precache and runtime cache names.

LOG_LEVELS

static

The available log levels in Workbox: debug, log, warn, error and silent.

Properties

Parameter

debug

int

Prints all logs from Workbox. Useful for debugging.

log

int

Prints console log, warn, error and groups. Default for debug builds.

warn

int

Prints console warn, error and groups. Default for non-debug builds.

error

int

Print console error and groups.

silent

int

Force no logging from Workbox.

logLevel

static

Get the current log level.

Returns

number .

Methods

registerQuotaErrorCallback

static

registerQuotaErrorCallback(callback)

Adds a function to the set of callbacks that will be executed when there's a quota error.

Parameter

callback

function()

setCacheNameDetails

static

setCacheNameDetails(details)

You can alter the default cache names used by the Workbox modules by changing the cache name details.

Cache names are generated as <prefix>-<Cache Name>-<suffix>.

Parameter

details

Object

Values in details have the following properties:

Parameter

prefix

Object

The string to add to the beginning of the precache and runtime cache names.

suffix

Object

The string to add to the end of the precache and runtime cache names.

precache

Object

The cache name to use for precache caching.

runtime

Object

The cache name to use for runtime caching.

googleAnalytics

Object

The cache name to use for workbox-google-analytics caching.

setLogLevel

static

setLogLevel(newLevel)

Set the current log level passing in one of the values from LOG_LEVELS.

Parameter

newLevel

number

The new log level to use.