English
CacheableResponse
Class @vite-pwa/workbox-swkit/cacheable-responseThis 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.
Constructor
ts
new CacheableResponse(config: CacheableResponseOptions)To construct a new CacheableResponse instance you must provide at least one of the config properties.
If both statuses and headers are specified, then both conditions must be met for the Response to be considered cacheable.
Methods
isResponseCacheable()
ts
isResponseCacheable(response: Response): booleanChecks a response to see whether it's cacheable or not, based on this object's configuration.
Parameters
response– The response whose cacheability is being checked.
Returns: true if the Response is cacheable, and false otherwise.