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
config
properties.If both
statuses
andheaders
are specified, then both conditions must be met for theResponse
to be considered cacheable.The
constructor
function 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
isResponseCacheable
function looks like:(response: Response) => {...}
- response
Response
The response whose cacheability is being checked.
- returns
boolean
true
if theResponse
is cacheable, andfalse
otherwise.
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
config
properties.If both
statuses
andheaders
are specified, then both conditions must be met for theResponse
to be considered cacheable.The
constructor
function looks like:(config: CacheableResponseOptions) => {...}
- config
- returns