-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
116 additions
and
8 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
{ | ||
"name": "Recursos ICGC en obert", | ||
"short_name": "Recursos ICGC en obert", | ||
"icons": [ | ||
{ | ||
"src": "icgc_icon_192x192.png", | ||
"sizes": "192x192", | ||
"type": "image/png", | ||
"purpose": "maskable any" | ||
}, | ||
{ | ||
"src": "icgc_icon_256x256.png", | ||
"sizes": "256x256", | ||
"type": "image/png", | ||
"purpose": "maskable any" | ||
}, | ||
{ | ||
"src": "icgc_icon_512x512.png", | ||
"sizes": "512x512", | ||
"type": "image/png", | ||
"purpose": "maskable any" | ||
} | ||
], | ||
"start_url": "/", | ||
"scope": "/", | ||
"display": "standalone", | ||
"background_color": "#3E4EB8", | ||
"theme_color": "#2F3BA2" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<!DOCTYPE html><html lang="en"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta http-equiv="X-UA-Compatible" content="ie=edge"><title>Idescat</title></head><body> <header class="app-header"> <h1 class="app-header__heading">You Are Offline</h1> </header> <main class="app-content"> <p> This content is not available while offline. Sorry. </p> </main> <script>"serviceWorker"in navigator&&navigator.serviceWorker.register("serviceworker.js").then(function(e){}).catch(function(e){});</script> </body></html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
'use strict'; | ||
// Update cache names any time any of the cached files change. | ||
const CACHE_NAME = 'static-cache-v1'; | ||
// Add list of files to cache here. | ||
const FILES_TO_CACHE = [ | ||
'offline.html', | ||
]; | ||
self.addEventListener('install', (evt) => { | ||
// console.log('[ServiceWorker] Install'); | ||
evt.waitUntil( | ||
caches.open(CACHE_NAME).then((cache) => { | ||
// console.log('[ServiceWorker] Pre-caching offline page'); | ||
return cache.addAll(FILES_TO_CACHE); | ||
}) | ||
); | ||
self.skipWaiting(); | ||
}); | ||
self.addEventListener('activate', (evt) => { | ||
// console.log('[ServiceWorker] Activate'); | ||
// Remove previous cached data from disk. | ||
evt.waitUntil( | ||
caches.keys().then((keyList) => { | ||
return Promise.all(keyList.map((key) => { | ||
if (key !== CACHE_NAME) { | ||
// console.log('[ServiceWorker] Removing old cache', key); | ||
return caches.delete(key); | ||
} | ||
})); | ||
}) | ||
); | ||
self.clients.claim(); | ||
}); | ||
self.addEventListener('fetch', (evt) => { | ||
// console.log('[ServiceWorker] Fetch', evt.request.url); | ||
// Add fetch event handler here. | ||
if (evt.request.mode !== 'navigate') { | ||
// Not a page navigation, bail. | ||
return; | ||
} | ||
evt.respondWith( | ||
fetch(evt.request) | ||
.catch(() => { | ||
return caches.open(CACHE_NAME) | ||
.then((cache) => { | ||
return cache.match('offline.html'); | ||
}); | ||
}) | ||
); | ||
}); |