forked from continuation-team/unity-ton-connect
-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
30 additions
and
2 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Large diffs are not rendered by default.
Oops, something went wrong.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,33 @@ | ||
const cacheName = "Veittech-Uniton Connect-1.0"; | ||
const contentToCache = [ | ||
"Build/Veittech-UnitonConnect-WebPage.loader.js", | ||
"Build/Veittech-UnitonConnect-WebPage.framework.js.unityweb", | ||
"Build/Veittech-UnitonConnect-WebPage.data.unityweb", | ||
"Build/Veittech-UnitonConnect-WebPage.wasm.unityweb", | ||
"TemplateData/style.css" | ||
|
||
]; | ||
|
||
self.addEventListener('install', function (e) { | ||
console.log('[Service Worker] Install'); | ||
|
||
e.waitUntil((async function () { | ||
const cache = await caches.open(cacheName); | ||
console.log('[Service Worker] Caching all: app shell and content'); | ||
await cache.addAll(contentToCache); | ||
})()); | ||
}); | ||
|
||
self.addEventListener('fetch', function (e) { | ||
e.respondWith((async function () { | ||
let response = await caches.match(e.request); | ||
console.log(`[Service Worker] Fetching resource: ${e.request.url}`); | ||
if (response) { return response; } | ||
|
||
response = await fetch(e.request); | ||
const cache = await caches.open(cacheName); | ||
console.log(`[Service Worker] Caching new resource: ${e.request.url}`); | ||
cache.put(e.request, response.clone()); | ||
return response; | ||
})()); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"url":"https://mrveit.github.io/Uniton-Connect/","name":"Uniton Connect","iconUrl":"https://mrveit.github.io/Uniton-Connect/icon.png"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters