source: frontend/node_modules/workbox-routing/src/utils/getOrCreateDefaultRouter.ts

Last change on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 2 weeks ago

Fix frontend appearance

  • Property mode set to 100644
File size: 740 bytes
RevLine 
[9af201e]1/*
2 Copyright 2019 Google LLC
3
4 Use of this source code is governed by an MIT-style
5 license that can be found in the LICENSE file or at
6 https://opensource.org/licenses/MIT.
7*/
8
9import {Router} from '../Router.js';
10import '../_version.js';
11
12let defaultRouter: Router;
13
14/**
15 * Creates a new, singleton Router instance if one does not exist. If one
16 * does already exist, that instance is returned.
17 *
18 * @private
19 * @return {Router}
20 */
21export const getOrCreateDefaultRouter = (): Router => {
22 if (!defaultRouter) {
23 defaultRouter = new Router();
24
25 // The helpers that use the default Router assume these listeners exist.
26 defaultRouter.addFetchListener();
27 defaultRouter.addCacheListener();
28 }
29 return defaultRouter;
30};
Note: See TracBrowser for help on using the repository browser.