mirror of
https://github.com/Michatec/MiniFaceBook.git
synced 2026-03-31 23:46:30 +02:00
Files
This commit is contained in:
19
static/js/sw.js
Normal file
19
static/js/sw.js
Normal file
@@ -0,0 +1,19 @@
|
||||
const CACHE_NAME = "minifb-v1";
|
||||
const urlsToCache = [
|
||||
"/",
|
||||
"/static/css/styles.css",
|
||||
"/static/js/theme.js",
|
||||
"/static/manifest.json"
|
||||
];
|
||||
|
||||
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))
|
||||
);
|
||||
});
|
||||
Reference in New Issue
Block a user