CacheableResponsePlugin.d.ts 1.4 KB

123456789101112131415161718192021222324252627282930313233343536
  1. import { WorkboxPlugin } from 'workbox-core/types.js';
  2. import { CacheableResponseOptions } from './CacheableResponse.js';
  3. import './_version.js';
  4. /**
  5. * A class implementing the `cacheWillUpdate` lifecycle callback. This makes it
  6. * easier to add in cacheability checks to requests made via Workbox's built-in
  7. * strategies.
  8. *
  9. * @memberof module:workbox-cacheable-response
  10. */
  11. declare class CacheableResponsePlugin implements WorkboxPlugin {
  12. private readonly _cacheableResponse;
  13. /**
  14. * To construct a new CacheableResponsePlugin instance you must provide at
  15. * least one of the `config` properties.
  16. *
  17. * If both `statuses` and `headers` are specified, then both conditions must
  18. * be met for the `Response` to be considered cacheable.
  19. *
  20. * @param {Object} config
  21. * @param {Array<number>} [config.statuses] One or more status codes that a
  22. * `Response` can have and be considered cacheable.
  23. * @param {Object<string,string>} [config.headers] A mapping of header names
  24. * and expected values that a `Response` can have and be considered cacheable.
  25. * If multiple headers are provided, only one needs to be present.
  26. */
  27. constructor(config: CacheableResponseOptions);
  28. /**
  29. * @param {Object} options
  30. * @param {Response} options.response
  31. * @return {Response|null}
  32. * @private
  33. */
  34. cacheWillUpdate: WorkboxPlugin['cacheWillUpdate'];
  35. }
  36. export { CacheableResponsePlugin };