cacheNames.js 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /*
  2. Copyright 2019 Google LLC
  3. Use of this source code is governed by an MIT-style
  4. license that can be found in the LICENSE file or at
  5. https://opensource.org/licenses/MIT.
  6. */
  7. import { cacheNames as _cacheNames } from './_private/cacheNames.js';
  8. import './_version.js';
  9. /**
  10. * Get the current cache names and prefix/suffix used by Workbox.
  11. *
  12. * `cacheNames.precache` is used for precached assets,
  13. * `cacheNames.googleAnalytics` is used by `workbox-google-analytics` to
  14. * store `analytics.js`, and `cacheNames.runtime` is used for everything else.
  15. *
  16. * `cacheNames.prefix` can be used to retrieve just the current prefix value.
  17. * `cacheNames.suffix` can be used to retrieve just the current suffix value.
  18. *
  19. * @return {Object} An object with `precache`, `runtime`, `prefix`, and
  20. * `googleAnalytics` properties.
  21. *
  22. * @memberof module:workbox-core
  23. */
  24. const cacheNames = {
  25. get googleAnalytics() {
  26. return _cacheNames.getGoogleAnalyticsName();
  27. },
  28. get precache() {
  29. return _cacheNames.getPrecacheName();
  30. },
  31. get prefix() {
  32. return _cacheNames.getPrefix();
  33. },
  34. get runtime() {
  35. return _cacheNames.getRuntimeName();
  36. },
  37. get suffix() {
  38. return _cacheNames.getSuffix();
  39. },
  40. };
  41. export { cacheNames };