workbox-cacheable-response
Summary
- Types
Types
CacheableResponse
This class allows you to set up rules determining what status codes and/or headers need to be present in order for a Response to be considered cacheable.
Properties
- constructor
function
To construct a new CacheableResponse instance you must provide at least one of the
configproperties.If both
statusesandheadersare specified, then both conditions must be met for theResponseto be considered cacheable.The
constructorfunction looks like:(config?: CacheableResponseOptions) => {...}- config
CacheableResponseOptions optional
- returns
- isResponseCacheable
function
Checks a response to see whether it's cacheable or not, based on this object's configuration.
The
isResponseCacheablefunction looks like:(response: Response) => {...}- response
Response
The response whose cacheability is being checked.
- returns
boolean
trueif theResponseis cacheable, andfalseotherwise.
CacheableResponseOptions
Properties
- headers
object optional
- statuses
number[] optional
CacheableResponsePlugin
A class implementing the cacheWillUpdate lifecycle callback. This makes it easier to add in cacheability checks to requests made via Workbox's built-in strategies.
Properties
- constructor
function
To construct a new CacheableResponsePlugin instance you must provide at least one of the
configproperties.If both
statusesandheadersare specified, then both conditions must be met for theResponseto be considered cacheable.The
constructorfunction looks like:(config: CacheableResponseOptions) => {...}- config
- returns