Constructor

CacheableResponse

new CacheableResponse(input)

Creates a new Plugin instance, which stores configuration and logic to determine whether a Response object is cacheable or not.

If multiple criteria are present (e.g. both statuses and headers), then the Response needs to meet all of the criteria to be cacheable.

Parameter

input

Object

Example

new workbox.cacheableResponse.CacheableResponse({
  statuses: [0, 200, 404],
  headers: {
    'Example-Header-1': 'Header-Value-1'
    'Example-Header-2': 'Header-Value-2'
  }
})

Method

isResponseCacheable

isResponseCacheable(input) returns boolean

Checks a response to see whether it's cacheable or not, based on the configuration of this object.

Parameter

input

Object

Returns

boolean true if the Response is cacheable, based on the configuration of this object, and false otherwise.