forked from admin/french-vocab
feat: 法语词汇学习应用
- Vue 3 + TypeScript + Tailwind CSS - 词汇学习和管理功能 - 支持生词本和复习
This commit is contained in:
24
public/sw.js
Normal file
24
public/sw.js
Normal file
@@ -0,0 +1,24 @@
|
||||
const CACHE_NAME = 'french-vocab-v1';
|
||||
const urlsToCache = [
|
||||
'/',
|
||||
'/index.html',
|
||||
'/assets/index.css',
|
||||
'/assets/index.js'
|
||||
];
|
||||
|
||||
self.addEventListener('install', (event) => {
|
||||
event.waitUntil(
|
||||
caches.open(CACHE_NAME)
|
||||
.then((cache) => cache.addAll(urlsToCache))
|
||||
);
|
||||
});
|
||||
|
||||
self.addEventListener('fetch', (event) => {
|
||||
event.respondWith(
|
||||
caches.match(event.request)
|
||||
.then((response) => {
|
||||
if (response) return response;
|
||||
return fetch(event.request);
|
||||
})
|
||||
);
|
||||
});
|
||||
Reference in New Issue
Block a user