diff --git a/public/index.html b/public/index.html index a6f924aa..ad3dfac3 100644 --- a/public/index.html +++ b/public/index.html @@ -30,10 +30,10 @@ - + + To create a production bundle, use `npm run build` or `yarn build`. --> +
+ + diff --git a/public/manifest.json b/public/manifest.json index 2e13c649..e04b53f9 100644 --- a/public/manifest.json +++ b/public/manifest.json @@ -18,7 +18,7 @@ "sizes": "512x512" } ], - "start_url": ".", + "start_url": "index.html", "display": "standalone", "theme_color": "#000000", "background_color": "#ffffff" diff --git a/public/serviceWorker.js b/public/serviceWorker.js new file mode 100644 index 00000000..655eced8 --- /dev/null +++ b/public/serviceWorker.js @@ -0,0 +1,22 @@ +let CACHE_NAME = 'my-site-cache-v1'; +const urlsToCache=[ + '/', + '/index.html', +]; +self.addEventListener('install', function(event) { + event.waitUntil( + caches.open(CACHE_NAME).then(function(cache){ + console.log('Opened cache'); + return cache.addAll(urlsToCache); + }) + ); + self.skipWaiting(); +}); +self.addEventListener('fetch', function(event){ + event.respondWith(caches.match(event.request).then(function(response){ + if (response) { + return response; + } + return fetch(event.request); + })); +}) \ No newline at end of file