diff options
| author | Adam Soltys <[email protected]> | 2022-11-09 23:13:53 -0800 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2022-11-09 23:13:53 -0800 |
| commit | 7e9aeb067f660817a8fc53252dff11c50a14b43d (patch) | |
| tree | 293baf045b3c41eb4bba4d09fcb016d7b4a26b88 /src | |
| parent | b431394dc68be9d2722a597b3eed21aea5f4ca61 (diff) | |
| download | coinos-ui-7e9aeb067f660817a8fc53252dff11c50a14b43d.tar.gz coinos-ui-7e9aeb067f660817a8fc53252dff11c50a14b43d.zip | |
mv service worker
Diffstat (limited to 'src')
| -rw-r--r-- | src/app.html | 14 | ||||
| -rw-r--r-- | src/service-worker.js | 7 |
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); + }) + ); +}); |
