mirror of
https://github.com/Unkn0wnCat/data-toolbox-site.git
synced 2025-06-15 22:51:37 +02:00
Fix caching mistake
This commit is contained in:
parent
ca0a6cf102
commit
8bd7891ef8
2 changed files with 20 additions and 2 deletions
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "kevins-data-toolbox",
|
||||
"version": "2.2.3",
|
||||
"version": "2.2.4",
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"@loadable/component": "^5.15.0",
|
||||
|
|
|
@ -14,12 +14,13 @@ import { precacheAndRoute, createHandlerBoundToURL } from 'workbox-precaching';
|
|||
import { registerRoute } from 'workbox-routing';
|
||||
import { StaleWhileRevalidate } from 'workbox-strategies';
|
||||
import {setCacheNameDetails} from 'workbox-core';
|
||||
import {version} from '../package.json';
|
||||
|
||||
declare const self: ServiceWorkerGlobalScope;
|
||||
|
||||
setCacheNameDetails({
|
||||
prefix: 'kevins-toolbox',
|
||||
suffix: 'v1',
|
||||
suffix: 'v'+version,
|
||||
precache: 'precache',
|
||||
runtime: 'runtime'
|
||||
});
|
||||
|
@ -96,3 +97,20 @@ registerRoute(
|
|||
plugins: []
|
||||
})
|
||||
)
|
||||
|
||||
self.addEventListener('activate', function(event) {
|
||||
event.waitUntil(
|
||||
caches.keys().then(function(cacheNames) {
|
||||
return Promise.all(
|
||||
cacheNames.filter(function(cacheName) {
|
||||
if (cacheName.startsWith('kevins-toolbox') && cacheName !== 'kevins-toolbox-precache-v'+version) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}).map(function(cacheName) {
|
||||
return caches.delete(cacheName);
|
||||
})
|
||||
);
|
||||
})
|
||||
);
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue