source: frontend/node_modules/workbox-routing/utils/getOrCreateDefaultRouter.js

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

Fix frontend appearance

  • Property mode set to 100644
File size: 744 bytes
Line 
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*/
8import { Router } from '../Router.js';
9import '../_version.js';
10let defaultRouter;
11/**
12 * Creates a new, singleton Router instance if one does not exist. If one
13 * does already exist, that instance is returned.
14 *
15 * @private
16 * @return {Router}
17 */
18export const getOrCreateDefaultRouter = () => {
19 if (!defaultRouter) {
20 defaultRouter = new Router();
21 // The helpers that use the default Router assume these listeners exist.
22 defaultRouter.addFetchListener();
23 defaultRouter.addCacheListener();
24 }
25 return defaultRouter;
26};
Note: See TracBrowser for help on using the repository browser.