CacheFirst.d.ts 1.0 KB

12345678910111213141516171819202122232425262728
  1. import { Strategy } from './Strategy.js';
  2. import { StrategyHandler } from './StrategyHandler.js';
  3. import './_version.js';
  4. /**
  5. * An implementation of a [cache-first](https://developer.chrome.com/docs/workbox/caching-strategies-overview/#cache-first-falling-back-to-network)
  6. * request strategy.
  7. *
  8. * A cache first strategy is useful for assets that have been revisioned,
  9. * such as URLs like `/styles/example.a8f5f1.css`, since they
  10. * can be cached for long periods of time.
  11. *
  12. * If the network request fails, and there is no cache match, this will throw
  13. * a `WorkboxError` exception.
  14. *
  15. * @extends workbox-strategies.Strategy
  16. * @memberof workbox-strategies
  17. */
  18. declare class CacheFirst extends Strategy {
  19. /**
  20. * @private
  21. * @param {Request|string} request A request to run this strategy for.
  22. * @param {workbox-strategies.StrategyHandler} handler The event that
  23. * triggered the request.
  24. * @return {Promise<Response>}
  25. */
  26. _handle(request: Request, handler: StrategyHandler): Promise<Response>;
  27. }
  28. export { CacheFirst };