test
This commit is contained in:
parent
66417c8753
commit
61a19a598b
|
@ -31,7 +31,8 @@ class SwLang {
|
||||||
const localeUrl = `/assets/locales/${await this.lang}.${_VERSION_}.json`;
|
const localeUrl = `/assets/locales/${await this.lang}.${_VERSION_}.json`;
|
||||||
let localeRes = await caches.match(localeUrl);
|
let localeRes = await caches.match(localeUrl);
|
||||||
|
|
||||||
if (!localeRes) {
|
// _DEV_がtrueの場合は常に最新化
|
||||||
|
if (!localeRes || _DEV_) {
|
||||||
localeRes = await fetch(localeUrl);
|
localeRes = await fetch(localeUrl);
|
||||||
const clone = localeRes?.clone();
|
const clone = localeRes?.clone();
|
||||||
if (!clone?.clone().ok) Error('locale fetching error');
|
if (!clone?.clone().ok) Error('locale fetching error');
|
||||||
|
|
|
@ -33,10 +33,10 @@ self.addEventListener('activate', ev => {
|
||||||
});
|
});
|
||||||
//#endregion
|
//#endregion
|
||||||
|
|
||||||
// TODO: 消せるかも ref. https://github.com/syuilo/misskey/pull/7108#issuecomment-774573666
|
|
||||||
//#region When: Fetching
|
//#region When: Fetching
|
||||||
self.addEventListener('fetch', ev => {
|
self.addEventListener('fetch', ev => {
|
||||||
if (ev.request.method !== 'GET' || ev.request.url.startsWith(apiUrl)) return;
|
/*
|
||||||
|
if (ev.request.url.startsWith(`${location.origin}/assets/locales/`)) {
|
||||||
ev.respondWith(
|
ev.respondWith(
|
||||||
caches.match(ev.request)
|
caches.match(ev.request)
|
||||||
.then(response => {
|
.then(response => {
|
||||||
|
@ -44,6 +44,8 @@ self.addEventListener('fetch', ev => {
|
||||||
})
|
})
|
||||||
.catch(() => new Response('SW cathces error while fetching. You may not be connected to the Internet, or the server may be down.', { status: 200, statusText: 'OK SW' }))
|
.catch(() => new Response('SW cathces error while fetching. You may not be connected to the Internet, or the server may be down.', { status: 200, statusText: 'OK SW' }))
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
*/
|
||||||
});
|
});
|
||||||
//#endregion
|
//#endregion
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue