mirror of
https://github.com/paricafe/misskey.git
synced 2024-11-24 16:26:44 -06:00
parent
42b9efd118
commit
f4a4acf467
1 changed files with 10 additions and 31 deletions
|
@ -12,29 +12,8 @@ import { createEmptyNotification, createNotification } from '@/scripts/create-no
|
|||
import { swLang } from '@/scripts/lang.js';
|
||||
import * as swos from '@/scripts/operations.js';
|
||||
|
||||
const CACHE_NAME = `pari-cache-${_VERSION_}`;
|
||||
const urlsToCache = [
|
||||
'/manifest.json',
|
||||
'/assets',
|
||||
'/emoji',
|
||||
'/twemoji',
|
||||
'/fluent-emoji',
|
||||
'/vite',
|
||||
'/identicon',
|
||||
'/proxy'
|
||||
];
|
||||
|
||||
globalThis.addEventListener('install', async (event) => {
|
||||
event.waitUntil(
|
||||
caches.keys().then(cacheNames => {
|
||||
return Promise.all(
|
||||
cacheNames
|
||||
.filter(name => name.startsWith('pari-cache-'))
|
||||
.map(name => caches.delete(name))
|
||||
);
|
||||
})
|
||||
);
|
||||
await globalThis.skipWaiting();
|
||||
globalThis.addEventListener('install', () => {
|
||||
// ev.waitUntil(globalThis.skipWaiting());
|
||||
});
|
||||
|
||||
globalThis.addEventListener('activate', ev => {
|
||||
|
@ -42,10 +21,10 @@ globalThis.addEventListener('activate', ev => {
|
|||
caches.keys()
|
||||
.then(cacheNames => Promise.all(
|
||||
cacheNames
|
||||
.filter(name => name.startsWith('pari-cache-') || urlsToCache.some(url => name.includes(url)))
|
||||
.map(name => caches.delete(name))
|
||||
.filter((v) => v !== swLang.cacheName)
|
||||
.map(name => caches.delete(name)),
|
||||
))
|
||||
.then(() => globalThis.clients.claim())
|
||||
.then(() => globalThis.clients.claim()),
|
||||
);
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in a new issue