mirror of
https://github.com/Unkn0wnCat/data-toolbox-site.git
synced 2025-06-17 23:31:36 +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",
|
"name": "kevins-data-toolbox",
|
||||||
"version": "2.2.3",
|
"version": "2.2.4",
|
||||||
"private": true,
|
"private": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@loadable/component": "^5.15.0",
|
"@loadable/component": "^5.15.0",
|
||||||
|
|
|
@ -14,12 +14,13 @@ import { precacheAndRoute, createHandlerBoundToURL } from 'workbox-precaching';
|
||||||
import { registerRoute } from 'workbox-routing';
|
import { registerRoute } from 'workbox-routing';
|
||||||
import { StaleWhileRevalidate } from 'workbox-strategies';
|
import { StaleWhileRevalidate } from 'workbox-strategies';
|
||||||
import {setCacheNameDetails} from 'workbox-core';
|
import {setCacheNameDetails} from 'workbox-core';
|
||||||
|
import {version} from '../package.json';
|
||||||
|
|
||||||
declare const self: ServiceWorkerGlobalScope;
|
declare const self: ServiceWorkerGlobalScope;
|
||||||
|
|
||||||
setCacheNameDetails({
|
setCacheNameDetails({
|
||||||
prefix: 'kevins-toolbox',
|
prefix: 'kevins-toolbox',
|
||||||
suffix: 'v1',
|
suffix: 'v'+version,
|
||||||
precache: 'precache',
|
precache: 'precache',
|
||||||
runtime: 'runtime'
|
runtime: 'runtime'
|
||||||
});
|
});
|
||||||
|
@ -96,3 +97,20 @@ registerRoute(
|
||||||
plugins: []
|
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