Não pode escolher mais do que 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
 
 
 
 

62 linhas
1.8 KiB

  1. /*
  2. Copyright 2017 Google Inc.
  3. Licensed under the Apache License, Version 2.0 (the "License");
  4. you may not use this file except in compliance with the License.
  5. You may obtain a copy of the License at
  6. https://www.apache.org/licenses/LICENSE-2.0
  7. Unless required by applicable law or agreed to in writing, software
  8. distributed under the License is distributed on an "AS IS" BASIS,
  9. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. See the License for the specific language governing permissions and
  11. limitations under the License.
  12. */
  13. import {logger} from 'workbox-core/_private/logger.mjs';
  14. import '../_version.mjs';
  15. const logGroup = (groupTitle, urls) => {
  16. logger.groupCollapsed(groupTitle);
  17. urls.forEach((url) => {
  18. logger.log(url);
  19. });
  20. logger.groupEnd();
  21. };
  22. /**
  23. * @param {Array<string>} deletedCacheRequests
  24. * @param {Array<string>} deletedRevisionDetails
  25. *
  26. * @private
  27. * @memberof module:workbox-precachig
  28. */
  29. export default (deletedCacheRequests, deletedRevisionDetails) => {
  30. if (deletedCacheRequests.length === 0 &&
  31. deletedRevisionDetails.length === 0) {
  32. return;
  33. }
  34. const cacheDeleteCount = deletedCacheRequests.length;
  35. const revisionDeleteCount = deletedRevisionDetails.length;
  36. const cacheDeleteText =
  37. `${cacheDeleteCount} cached ` +
  38. `request${cacheDeleteCount === 1 ? ' was' : 's were'} deleted`;
  39. const revisionDeleteText =
  40. `${revisionDeleteCount} ` +
  41. `${revisionDeleteCount === 1 ? 'entry' : 'entries'} ` +
  42. `${revisionDeleteCount === 1 ? 'was' : 'were'} deleted from IndexedDB.`;
  43. logger.groupCollapsed(
  44. `During precaching cleanup, ${cacheDeleteText} and ${revisionDeleteText}`);
  45. logGroup('Deleted Cache Requests', deletedCacheRequests);
  46. logGroup('Revision Details Deleted from DB', deletedRevisionDetails);
  47. logger.groupEnd();
  48. };