Added PWA

This commit is contained in:
Thomas Cole 2021-07-23 08:05:45 -04:00
parent fa93a220ce
commit 0c138a4ccb
36 changed files with 15324 additions and 1 deletions

1
public/build/bundle.css Normal file

File diff suppressed because one or more lines are too long

15226
public/build/bundle.js Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

View File

@ -4,15 +4,24 @@
<meta charset='utf-8'> <meta charset='utf-8'>
<meta name='viewport' content='width=device-width,initial-scale=1'> <meta name='viewport' content='width=device-width,initial-scale=1'>
<title>Svelte material app</title> <title>Svelte Material App</title>
<link rel='icon' type='image/png' href='./favicon.png'> <link rel='icon' type='image/png' href='./favicon.png'>
<link rel='stylesheet' href='./global.css'> <link rel='stylesheet' href='./global.css'>
<link rel='stylesheet' href='./build/bundle.css'> <link rel='stylesheet' href='./build/bundle.css'>
<link rel="manifest" href="manifest.json">
<script defer src='./build/bundle.js'></script> <script defer src='./build/bundle.js'></script>
</head> </head>
<body> <body>
<script>
if('serviceWorker' in navigator){
navigator.serviceWorker.register('service-worker.js');
}
</script>
</body> </body>
</html> </html>

23
public/manifest.json Normal file
View File

@ -0,0 +1,23 @@
{
"name": "Svelte Quickstart",
"short_name": "Quickstart",
"start_url": "/?home=true",
"icons": [
{
"src": "icons/manifest-icon-192.png",
"sizes": "192x192",
"type": "image/png",
"purpose": "maskable any"
},
{
"src": "icons/manifest-icon-512.png",
"sizes": "512x512",
"type": "image/png",
"purpose": "maskable any"
}
],
"theme_color": "#000000",
"background_color": "#ffffff",
"display": "fullscreen",
"orientation": "portrait"
}

34
public/offline.html Normal file
View File

@ -0,0 +1,34 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Svelte Material App</title>
<link rel='icon' type='image/png' href='./favicon.png'>
<style>
body{
margin: 0;
padding: 0;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
}
div{
height: 100vh;
width: 100%;
display: grid;
place-content: center;
text-align: center;
}
</style>
</head>
<body>
<div>
<h3>You appear to be offline.</h3>
<p>An internet connection is required to use this app.</p>
</div>
</body>
</html>

29
public/service-worker.js Normal file
View File

@ -0,0 +1,29 @@
const cacheName = 'cache-v1';
const cacheFiles = [
'/offline.html',
];
self.addEventListener('install', (event) => {
console.log('Service worker install event!');
event.waitUntil(caches.open(cacheName).then((cache) => cache.addAll(cacheFiles)));
});
self.addEventListener('activate', (event) => {
console.log('Service worker activate event!');
});
self.addEventListener('fetch', (event) => {
console.log('Fetch intercepted for:', event.request.url);
if(event.request.mode !== 'navigate'){
return;
}
event.respondWith(
fetch(event.request).catch(() => {
return caches.open(cacheName).then((cache) => {
return cache.match('offline.html')
})
})
);
});