Now a PWA (but just barely)

This commit is contained in:
Neale Pickett 2020-05-26 20:52:48 -06:00
parent aa4957bd0e
commit d7de183d4c
5 changed files with 34 additions and 2 deletions

View File

@ -11,7 +11,8 @@
<script defer src="https://code.getmdl.io/1.3.0/material.min.js"></script>
<!-- Vail stuff -->
<link rel="icon" href="vail.png" sizes="128x128" type="image/png">
<link rel="manifest" href="manifest.json">
<link rel="icon" href="vail.png" sizes="256x256" type="image/png">
<link rel="icon" href="vail.svg" sizes="any" type="image/svg+xml">
<script src="vail.js"></script>
<link rel="stylesheet" href="vail.css">

13
static/manifest.json Normal file
View File

@ -0,0 +1,13 @@
{
"name": "Vail: Morse Code",
"short_name": "Vail",
"start_url": ".",
"display": "standalone",
"background_color": "#fff",
"theme_color": "#009688",
"description": "Internet Morse Code client",
"icons": [
{"src": "vail.png", "sizes": "250x250"},
{"src": "vail.svg", "sizes": "150x150"}
]
}

15
static/sw.js Normal file
View File

@ -0,0 +1,15 @@
// jshint asi:true
console.log("moo")
self.addEventListener("install", install)
function install(event) {
console.log(event)
event.waitUntil(Promise.resolve(true))
}
self.addEventListener("fetch", fetcher)
function fetcher(event) {
event.respondWith(fetch(event.request))
}

View File

@ -618,6 +618,9 @@ class Vail {
}
function vailInit() {
if (navigator.serviceWorker) {
navigator.serviceWorker.register("sw.js")
}
try {
window.app = new Vail()
} catch (err) {

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 4.0 KiB