workbox-cacheable-response

    Review the guide for workbox-cacheable-response.

    Summary

    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 and headers are specified, then both conditions must be met for the Response to be considered cacheable.

      The constructor function looks like: (config?: CacheableResponseOptions) => {...}

    • 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 the Response is cacheable, and false 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 and headers are specified, then both conditions must be met for the Response to be considered cacheable.

      The constructor function looks like: (config: CacheableResponseOptions) => {...}

    We serve cookies on this site to analyze traffic, remember your preferences, and optimize your experience.