source: frontend/node_modules/workbox-precaching/utils/printInstallDetails.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: 1.4 KB
Line 
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*/
8import { logger } from 'workbox-core/_private/logger.js';
9import '../_version.js';
10/**
11 * @param {string} groupTitle
12 * @param {Array<string>} urls
13 *
14 * @private
15 */
16function _nestedGroup(groupTitle, urls) {
17 if (urls.length === 0) {
18 return;
19 }
20 logger.groupCollapsed(groupTitle);
21 for (const url of urls) {
22 logger.log(url);
23 }
24 logger.groupEnd();
25}
26/**
27 * @param {Array<string>} urlsToPrecache
28 * @param {Array<string>} urlsAlreadyPrecached
29 *
30 * @private
31 * @memberof workbox-precaching
32 */
33export function printInstallDetails(urlsToPrecache, urlsAlreadyPrecached) {
34 const precachedCount = urlsToPrecache.length;
35 const alreadyPrecachedCount = urlsAlreadyPrecached.length;
36 if (precachedCount || alreadyPrecachedCount) {
37 let message = `Precaching ${precachedCount} file${precachedCount === 1 ? '' : 's'}.`;
38 if (alreadyPrecachedCount > 0) {
39 message +=
40 ` ${alreadyPrecachedCount} ` +
41 `file${alreadyPrecachedCount === 1 ? ' is' : 's are'} already cached.`;
42 }
43 logger.groupCollapsed(message);
44 _nestedGroup(`View newly precached URLs.`, urlsToPrecache);
45 _nestedGroup(`View previously precached URLs.`, urlsAlreadyPrecached);
46 logger.groupEnd();
47 }
48}
Note: See TracBrowser for help on using the repository browser.