forked from MapComplete/MapComplete
Experimenting with service workers
This commit is contained in:
parent
acd1cdb7c1
commit
e5908cf49b
8 changed files with 141 additions and 19 deletions
17
theme.html
17
theme.html
|
@ -87,5 +87,22 @@
|
|||
<script src="./index.ts"></script>
|
||||
<script async data-goatcounter="https://pietervdvn.goatcounter.com/count" src="//gc.zgo.at/count.js"></script>
|
||||
|
||||
<script>
|
||||
window.addEventListener('load', () => {
|
||||
if ('serviceWorker' in navigator) {
|
||||
// register service worker
|
||||
navigator.serviceWorker.register('/service-worker.js').then(
|
||||
() => {
|
||||
console.log('SW registration successful');
|
||||
},
|
||||
err => {
|
||||
console.error('SW registration failed', err)
|
||||
});
|
||||
} else {
|
||||
console.log("Service workers are not supported")
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue