Skip to content

Commit b8ad8e7

Browse files
authored
Add mincoi
1 parent eed84c8 commit b8ad8e7

File tree

1 file changed

+32
-1
lines changed

1 file changed

+32
-1
lines changed

index.html

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,37 @@
99
<link rel="icon" type="image/x-icon" href="favicon.ico">
1010
<meta name="viewport" content="width=device-width,initial-scale=1">
1111

12+
<script>
13+
/*! coi-serviceworker v0.1.7 - Guido Zuidhof and contributors, licensed under MIT */
14+
/*! mini-coi - Andrea Giammarchi and contributors, licensed under MIT */
15+
(({ document: d, navigator: { serviceWorker: s } }) => {
16+
if (d) {
17+
const { currentScript: c } = d;
18+
s.register(c.src, { scope: c.getAttribute('scope') || '.' }).then(r => {
19+
r.addEventListener('updatefound', () => location.reload());
20+
if (r.active && !s.controller) location.reload();
21+
});
22+
}
23+
else {
24+
addEventListener('install', () => skipWaiting());
25+
addEventListener('activate', e => e.waitUntil(clients.claim()));
26+
addEventListener('fetch', e => {
27+
const { request: r } = e;
28+
if (r.cache === 'only-if-cached' && r.mode !== 'same-origin') return;
29+
e.respondWith(fetch(r).then(r => {
30+
const { body, status, statusText } = r;
31+
if (!status || status > 399) return r;
32+
const h = new Headers(r.headers);
33+
h.set('Cross-Origin-Opener-Policy', 'same-origin');
34+
h.set('Cross-Origin-Embedder-Policy', 'require-corp');
35+
h.set('Cross-Origin-Resource-Policy', 'cross-origin');
36+
return new Response(body, { status, statusText, headers: h });
37+
}));
38+
});
39+
}
40+
})(self);
41+
</script>
42+
1243
<!-- Import PyScript - see kitchensink.js for activation -->
1344
<script type="module" src="https://pyscript.net/releases/2023.11.1/core.js"></script>
1445
<link rel="stylesheet" href="https://pyscript.net/releases/2023.11.1/core.css" />
@@ -36,4 +67,4 @@ <h1 id="title">The <a href=https://github.com/laffra/ltk>LTK</a> Kitchensink for
3667
<script src="kitchensink.js"></script>
3768
</body>
3869

39-
</html>
70+
</html>

0 commit comments

Comments
 (0)