1234567891011121314151617181920212223242526272829303132 |
- import { cacheNames } from 'workbox-core/_private/cacheNames.js';
- import { logger } from 'workbox-core/_private/logger.js';
- import { deleteOutdatedCaches } from './utils/deleteOutdatedCaches.js';
- import './_version.js';
- function cleanupOutdatedCaches() {
-
- self.addEventListener('activate', ((event) => {
- const cacheName = cacheNames.getPrecacheName();
- event.waitUntil(deleteOutdatedCaches(cacheName).then((cachesDeleted) => {
- if (process.env.NODE_ENV !== 'production') {
- if (cachesDeleted.length > 0) {
- logger.log(`The following out-of-date precaches were cleaned up ` +
- `automatically:`, cachesDeleted);
- }
- }
- }));
- }));
- }
- export { cleanupOutdatedCaches };
|