mirror of
https://github.com/Zhuym07/Tsumugiboshi.git
synced 2025-05-20 06:27:27 +08:00
27 lines
611 B
JavaScript
27 lines
611 B
JavaScript
const CACHE_NAME = 'tsumugiboshi-v1';
|
|
const urlsToCache = [
|
|
'/',
|
|
'/index.html',
|
|
'/js/react.production.min.js',
|
|
'/js/react-dom.production.min.js',
|
|
'/js/babel.min.js',
|
|
'/js/material-ui.production.min.js',
|
|
'/config/label.json',
|
|
'/icons/icon-192x192.png',
|
|
'/icons/icon-512x512.png'
|
|
];
|
|
|
|
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 => response || fetch(event.request))
|
|
);
|
|
});
|