diff options
author | Daniel Friesel <derf@finalrewind.org> | 2019-05-03 20:43:46 +0200 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2019-05-03 20:43:46 +0200 |
commit | 709919a9624ed4336e9e5ae382e29cd34c795a82 (patch) | |
tree | 5562aa8a08048666c162db008db9b69dc554d4c6 /public | |
parent | 9f3b80a859a8e54856dd283b635a4abfe377feb9 (diff) |
Experimental PWA support (#13)
Diffstat (limited to 'public')
-rw-r--r-- | public/service-worker.js | 47 | ||||
-rw-r--r-- | public/static/icons/icon-128x128.png | bin | 0 -> 1456 bytes | |||
-rw-r--r-- | public/static/icons/icon-144x144.png | bin | 0 -> 1565 bytes | |||
-rw-r--r-- | public/static/icons/icon-152x152.png | bin | 0 -> 1738 bytes | |||
-rw-r--r-- | public/static/icons/icon-192x192.png | bin | 0 -> 2139 bytes | |||
-rw-r--r-- | public/static/icons/icon-256x256.png | bin | 0 -> 2923 bytes | |||
-rw-r--r-- | public/static/icons/icon-512x512.png | bin | 0 -> 6611 bytes | |||
-rw-r--r-- | public/static/manifest.json | 34 |
8 files changed, 81 insertions, 0 deletions
diff --git a/public/service-worker.js b/public/service-worker.js new file mode 100644 index 0000000..2b5c556 --- /dev/null +++ b/public/service-worker.js @@ -0,0 +1,47 @@ +const CACHE_NAME = 'static-cache-v10'; +const FILES_TO_CACHE = [ + '/offline.html', + '/static/v10/css/materialize.min.css', + '/static/v10/css/material-icons.css', + '/static/v10/css/local.css', + '/static/v10/js/jquery-2.2.4.min.js', + '/static/v10/js/materialize.min.js', + '/static/v10/js/travelynx-actions.min.js', +]; + +self.addEventListener('install', (evt) => { + evt.waitUntil( + caches.open(CACHE_NAME).then((cache) => { + return cache.addAll(FILES_TO_CACHE); + }) + ); + self.skipWaiting(); +}); + +self.addEventListener('activate', (evt) => { + evt.waitUntil( + caches.keys().then((keyList) => { + return Promise.all(keyList.map((key) => { + if (key !== CACHE_NAME) { + return caches.delete(key); + } + })); + }) + ); + self.clients.claim(); +}); + +self.addEventListener('fetch', (evt) => { + if (evt.request.mode !== 'navigate') { + return; + } + evt.respondWith( + fetch(evt.request) + .catch(() => { + return caches.open(CACHE_NAME) + .then((cache) => { + return cache.match('offline.html'); + }); + }) + ); +}); diff --git a/public/static/icons/icon-128x128.png b/public/static/icons/icon-128x128.png Binary files differnew file mode 100644 index 0000000..2dfa5b4 --- /dev/null +++ b/public/static/icons/icon-128x128.png diff --git a/public/static/icons/icon-144x144.png b/public/static/icons/icon-144x144.png Binary files differnew file mode 100644 index 0000000..151e555 --- /dev/null +++ b/public/static/icons/icon-144x144.png diff --git a/public/static/icons/icon-152x152.png b/public/static/icons/icon-152x152.png Binary files differnew file mode 100644 index 0000000..a5a034d --- /dev/null +++ b/public/static/icons/icon-152x152.png diff --git a/public/static/icons/icon-192x192.png b/public/static/icons/icon-192x192.png Binary files differnew file mode 100644 index 0000000..a00418e --- /dev/null +++ b/public/static/icons/icon-192x192.png diff --git a/public/static/icons/icon-256x256.png b/public/static/icons/icon-256x256.png Binary files differnew file mode 100644 index 0000000..e9493a3 --- /dev/null +++ b/public/static/icons/icon-256x256.png diff --git a/public/static/icons/icon-512x512.png b/public/static/icons/icon-512x512.png Binary files differnew file mode 100644 index 0000000..074e828 --- /dev/null +++ b/public/static/icons/icon-512x512.png diff --git a/public/static/manifest.json b/public/static/manifest.json new file mode 100644 index 0000000..7e856f2 --- /dev/null +++ b/public/static/manifest.json @@ -0,0 +1,34 @@ +{ + "name": "travelynx", + "short_name": "travelynx", + "scope": "/", + "icons": [{ + "src": "/static/icons/icon-128x128.png", + "sizes": "128x128", + "type": "image/png" + }, { + "src": "/static/icons/icon-144x144.png", + "sizes": "144x144", + "type": "image/png" + }, { + "src": "/static/icons/icon-152x152.png", + "sizes": "152x152", + "type": "image/png" + }, { + "src": "/static/icons/icon-192x192.png", + "sizes": "192x192", + "type": "image/png" + }, { + "src": "/static/icons/icon-256x256.png", + "sizes": "256x256", + "type": "image/png" + }, { + "src": "/static/icons/icon-512x512.png", + "sizes": "512x512", + "type": "image/png" + }], + "start_url": "/", + "display": "standalone", + "background_color": "#ffffff", + "theme_color": "#673ab7" +} |