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

      void

      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

      void

      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

      void

      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) => {...}

    This site uses cookies to deliver and enhance the quality of its services and to analyze traffic. If you agree, cookies are also used to serve advertising and to personalize the content and advertisements that you see. Learn more about our use of cookies.