workbox. core
All of the Workbox service worker libraries use workbox-core for shared code as well as setting default values that need to be shared (like cache names).
Properties
cacheNames
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 withprecache
andruntime
cache names.
LOG_LEVELS
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
Get the current log level.
- Returns
-
number
.
Methods
setCacheNameDetails
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
|
setLogLevel
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. |