mirror of
https://github.com/profullstack/logicsrc.git
synced 2026-08-13 14:37:26 +00:00
Add LogicSRC standards MCP server
This commit is contained in:
parent
4e4c78140d
commit
dd150f391a
26 changed files with 2250 additions and 15 deletions
32
apps/logicsrc-web/public/service-worker.js
Normal file
32
apps/logicsrc-web/public/service-worker.js
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
const CACHE_NAME = "logicsrc-standards-v1";
|
||||
const SHELL_ASSETS = ["/", "/manifest.webmanifest", "/icon.svg"];
|
||||
|
||||
self.addEventListener("install", (event) => {
|
||||
event.waitUntil(caches.open(CACHE_NAME).then((cache) => cache.addAll(SHELL_ASSETS)));
|
||||
self.skipWaiting();
|
||||
});
|
||||
|
||||
self.addEventListener("activate", (event) => {
|
||||
event.waitUntil(
|
||||
caches.keys().then((keys) => Promise.all(keys.filter((key) => key !== CACHE_NAME).map((key) => caches.delete(key))))
|
||||
);
|
||||
self.clients.claim();
|
||||
});
|
||||
|
||||
self.addEventListener("fetch", (event) => {
|
||||
if (event.request.method !== "GET") {
|
||||
return;
|
||||
}
|
||||
|
||||
event.respondWith(
|
||||
fetch(event.request)
|
||||
.then((response) => {
|
||||
if (response.ok && new URL(event.request.url).origin === self.location.origin) {
|
||||
const clone = response.clone();
|
||||
caches.open(CACHE_NAME).then((cache) => cache.put(event.request, clone));
|
||||
}
|
||||
return response;
|
||||
})
|
||||
.catch(() => caches.match(event.request).then((cached) => cached || caches.match("/")))
|
||||
);
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue