source: frontend/node_modules/workbox-navigation-preload/src/disable.ts

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: 1.0 KB
RevLine 
[9af201e]1/*
2 Copyright 2018 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 {logger} from 'workbox-core/_private/logger.js';
10import {isSupported} from './isSupported.js';
11import './_version.js';
12
13// Give TypeScript the correct global.
14declare let self: ServiceWorkerGlobalScope;
15
16/**
17 * If the browser supports Navigation Preload, then this will disable it.
18 *
19 * @memberof workbox-navigation-preload
20 */
21function disable(): void {
22 if (isSupported()) {
23 self.addEventListener('activate', (event: ExtendableEvent) => {
24 event.waitUntil(
25 self.registration.navigationPreload.disable().then(() => {
26 if (process.env.NODE_ENV !== 'production') {
27 logger.log(`Navigation preload is disabled.`);
28 }
29 }),
30 );
31 });
32 } else {
33 if (process.env.NODE_ENV !== 'production') {
34 logger.log(`Navigation preload is not supported in this browser.`);
35 }
36 }
37}
38
39export {disable};
Note: See TracBrowser for help on using the repository browser.