RegExpRoute.d.ts 1.4 KB

12345678910111213141516171819202122232425262728293031323334
  1. import { HTTPMethod } from './utils/constants.js';
  2. import { Route } from './Route.js';
  3. import { Handler } from './_types.js';
  4. import './_version.js';
  5. /**
  6. * RegExpRoute makes it easy to create a regular expression based
  7. * [Route]{@link module:workbox-routing.Route}.
  8. *
  9. * For same-origin requests the RegExp only needs to match part of the URL. For
  10. * requests against third-party servers, you must define a RegExp that matches
  11. * the start of the URL.
  12. *
  13. * [See the module docs for info.]{@link https://developers.google.com/web/tools/workbox/modules/workbox-routing}
  14. *
  15. * @memberof module:workbox-routing
  16. * @extends module:workbox-routing.Route
  17. */
  18. declare class RegExpRoute extends Route {
  19. /**
  20. * If the regular expression contains
  21. * [capture groups]{@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp#grouping-back-references},
  22. * the captured values will be passed to the
  23. * [handler's]{@link module:workbox-routing~handlerCallback} `params`
  24. * argument.
  25. *
  26. * @param {RegExp} regExp The regular expression to match against URLs.
  27. * @param {module:workbox-routing~handlerCallback} handler A callback
  28. * function that returns a Promise resulting in a Response.
  29. * @param {string} [method='GET'] The HTTP method to match the Route
  30. * against.
  31. */
  32. constructor(regExp: RegExp, handler: Handler, method?: HTTPMethod);
  33. }
  34. export { RegExpRoute };