123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- import { assert } from 'workbox-core/_private/assert.js';
- import { defaultMethod, validMethods } from './utils/constants.js';
- import { normalizeHandler } from './utils/normalizeHandler.js';
- import './_version.js';
- class Route {
-
- constructor(match, handler, method = defaultMethod) {
- if (process.env.NODE_ENV !== 'production') {
- assert.isType(match, 'function', {
- moduleName: 'workbox-routing',
- className: 'Route',
- funcName: 'constructor',
- paramName: 'match',
- });
- if (method) {
- assert.isOneOf(method, validMethods, { paramName: 'method' });
- }
- }
-
-
- this.handler = normalizeHandler(handler);
- this.match = match;
- this.method = method;
- }
-
- setCatchHandler(handler) {
- this.catchHandler = normalizeHandler(handler);
- }
- }
- export { Route };
|