Sha256: b59302e7992bf84f5ea48f962e6c6524daff21804513c23755f200d5b41ab83a
Contents?: true
Size: 1.02 KB
Versions: 62
Compression:
Stored size: 1.02 KB
Contents
/** * On PWA installation, pre-cache the assets & offline page */ self.addEventListener('install', function (event) { event.waitUntil( caches.open('pwa_cache').then(function (cache) { return cache.addAll([ '<%= image_path("workarea/storefront/logo.png") %>', '<%= stylesheet_path("workarea/storefront/application.css") %>', '<%= javascript_path("workarea/storefront/head.js") %>', '<%= javascript_path("workarea/storefront/application.js") %>', '/offline' ]); }) ); }); /** * On PWA fetch, serve the offline system content page if the connection fails */ self.addEventListener('fetch', function (event) { if (event.request.mode !== 'navigate') { return; } if (event.request.method !== 'GET') { return; } if ( ! event.request.headers.get('accept').includes('text/html')) { return; } event.respondWith( fetch(event.request).catch(function () { return caches.match('/offline'); }) ); });
Version data entries
62 entries across 62 versions & 1 rubygems