From 7014e4c1aa9e07f2758edbb737dc7edbecda2a19 Mon Sep 17 00:00:00 2001 From: Martin Donnelly Date: Mon, 12 Feb 2018 12:58:31 +0000 Subject: [PATCH] updated service worker --- src/service-worker.js | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/service-worker.js b/src/service-worker.js index aec6256..7f1dde3 100644 --- a/src/service-worker.js +++ b/src/service-worker.js @@ -11,7 +11,7 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. - +const CACHE_VERSION = 1; const dataCacheName = 'traintimesData-v1'; const cacheName = 'traintimePWA-final-1'; const filesToCache = [ @@ -20,11 +20,12 @@ const filesToCache = [ '/service-worker.js', '/manifest.json', '/browserconfig.xml', - '/css/common.css', + '/css/style.min.css', '/css/mui.custom.css', '/fonts/fonts.css', - '/fonts/Roboto_Condensed-normal-400.woff', - '/fonts/Roboto_Slab-normal-400.woff', + '/fonts/gotham.css', + '/fonts/Roboto-normal-400.woff', + '/fonts/Roboto_Mono-normal-400.woff', '/js/bundle.js', '/js/vendor.js', '/img/Icon-36.png', @@ -41,7 +42,7 @@ self.addEventListener('install', function(e) { e.waitUntil( caches.open(cacheName).then(function(cache) { console.log('[ServiceWorker] Caching app shell'); - + return cache.addAll(filesToCache); }) ); @@ -54,7 +55,7 @@ self.addEventListener('activate', function(e) { return Promise.all(keyList.map(function(key) { if (key !== cacheName && key !== dataCacheName) { console.log('[ServiceWorker] Removing old cache', key); - + return caches.delete(key); } })); @@ -91,13 +92,13 @@ self.addEventListener('fetch', function(e) { caches.open(dataCacheName).then(function(cache) { return fetch(e.request).then(function(response) { cache.put(e.request.url, response.clone()); - + return response; }); }) ); } - else + else /* * The app is asking for app shell files. In this scenario the app uses the