Urara-Blog/node_modules/.pnpm-store/v3/files/5f/06ba51177e27ff133ebdc279ad5f3c9e5ceeb4ac9f2c9a4abfec9cdf41e5c04571627389849055e35675ab379211fcc9cb06bf312c205b4c489e2d868df3cb
2022-08-14 01:14:53 +08:00

32 lines
919 B
Text

/*
Copyright 2019 Google LLC
Use of this source code is governed by an MIT-style
license that can be found in the LICENSE file or at
https://opensource.org/licenses/MIT.
*/
import {RouteHandler} from 'workbox-core/types.js';
import {getOrCreateDefaultRouter} from './utils/getOrCreateDefaultRouter.js';
import './_version.js';
/**
* Define a default `handler` that's called when no routes explicitly
* match the incoming request.
*
* Without a default handler, unmatched requests will go against the
* network as if there were no service worker present.
*
* @param {workbox-routing~handlerCallback} handler A callback
* function that returns a Promise resulting in a Response.
*
* @memberof workbox-routing
*/
function setDefaultHandler(handler: RouteHandler): void {
const defaultRouter = getOrCreateDefaultRouter();
defaultRouter.setDefaultHandler(handler);
}
export {setDefaultHandler};