GoScrobble/web/node_modules/workbox-routing/RegExpRoute.d.ts

35 lines
1.4 KiB
TypeScript
Raw Permalink Normal View History

2022-04-25 02:47:15 +00:00
import { HTTPMethod } from './utils/constants.js';
import { Route } from './Route.js';
import { Handler } from './_types.js';
import './_version.js';
/**
* RegExpRoute makes it easy to create a regular expression based
* [Route]{@link module:workbox-routing.Route}.
*
* For same-origin requests the RegExp only needs to match part of the URL. For
* requests against third-party servers, you must define a RegExp that matches
* the start of the URL.
*
* [See the module docs for info.]{@link https://developers.google.com/web/tools/workbox/modules/workbox-routing}
*
* @memberof module:workbox-routing
* @extends module:workbox-routing.Route
*/
declare class RegExpRoute extends Route {
/**
* If the regular expression contains
* [capture groups]{@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp#grouping-back-references},
* the captured values will be passed to the
* [handler's]{@link module:workbox-routing~handlerCallback} `params`
* argument.
*
* @param {RegExp} regExp The regular expression to match against URLs.
* @param {module:workbox-routing~handlerCallback} handler A callback
* function that returns a Promise resulting in a Response.
* @param {string} [method='GET'] The HTTP method to match the Route
* against.
*/
constructor(regExp: RegExp, handler: Handler, method?: HTTPMethod);
}
export { RegExpRoute };