aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/app.html14
-rw-r--r--src/service-worker.js7
2 files changed, 7 insertions, 14 deletions
diff --git a/src/app.html b/src/app.html
index 0a2379a7..4a03a220 100644
--- a/src/app.html
+++ b/src/app.html
@@ -12,18 +12,4 @@
<body>
<div>%sveltekit.body%</div>
</body>
- <script>
- if ('serviceWorker' in navigator) {
- navigator.serviceWorker.register('/service-worker.js').then(
- function (registration) {
- console.log('Service worker registration succeeded:', registration);
- },
- function (error) {
- console.log('Service worker registration failed:', error);
- }
- );
- } else {
- console.log('Service workers are not supported.');
- }
- </script>
</html>
diff --git a/src/service-worker.js b/src/service-worker.js
new file mode 100644
index 00000000..7952231d
--- /dev/null
+++ b/src/service-worker.js
@@ -0,0 +1,7 @@
+self.addEventListener('fetch', function(event) {
+ event.respondWith(
+ caches.match(event.request).then(function(response) {
+ return response || fetch(event.request);
+ })
+ );
+});