This a base class which each caching strategy extends.


new Handler(input)

Constructor for a new Handler instance.

input Object
waitOnCache boolean (Optional)

For handlers that write to the cache, true means the method should wait for the cache.put() call to complete before returning. The default value of false means return without waiting. It this value is true and the response can't be cached, an error will be thrown.

requestWrapper RequestWrapper (Optional)

An optional RequestWrapper that is used to configure the cache name and request plugins. If not provided, a new RequestWrapper using the default cache name will be used.

Instance Methods

(abstract) this.handle(input) Promise.<Response>

An abstract method that each subclass must implement.

input Object
event FetchEvent

The event that triggered the service worker's fetch handler.

params Object (Optional)

Additional parameters that might be passed in to the method. If used in conjunction with the Route class, then the return value from the match function in the Route constructor will be passed in as the params value.

Returns Promise.<Response>

A promise resolving with a response.