hexo/node_modules/workbox-routing/RegExpRoute.d.ts

33 lines
1.3 KiB
TypeScript

import { RouteHandler } from 'workbox-core/types.js';
import { HTTPMethod } from './utils/constants.js';
import { Route } from './Route.js';
import './_version.js';
/**
* RegExpRoute makes it easy to create a regular expression based
* {@link 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.
*
* @memberof workbox-routing
* @extends 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
* {@link workbox-routing~handlerCallback} `params`
* argument.
*
* @param {RegExp} regExp The regular expression to match against URLs.
* @param {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: RouteHandler, method?: HTTPMethod);
}
export { RegExpRoute };