1
0

Initial commit

This commit is contained in:
2022-05-11 19:49:34 +00:00
committed by GitHub
commit 05a8cd39ed
35 changed files with 10972 additions and 0 deletions
+31
View File
@@ -0,0 +1,31 @@
let filesToCache =
[
"/",
"/apple-touch-icon.png",
"/icon-512.png",
"/favicon.ico",
"/favicon.svg",
"/banner.png",
"/en",
"/ru"
];
self.addEventListener("install", e =>
{
e.waitUntil(
// Get React bundle files list to cache
fetch("/asset-manifest.json")
.then(response => response.json())
.then(assets => filesToCache.concat(Object.entries(assets.files).map(i => i[1])))
.then(() => caches.open("easylogon-demo"))
.then(cache => cache.addAll(filesToCache))
);
});
self.addEventListener("fetch", event =>
event.respondWith((async () =>
{
let response = await caches.match(event.request);
return response || await fetch(event.request);
})()));