ctucx.git: smartie-pwa

[js] smarthome web-gui

commit bc35ad7ba8fa6e9e373434fab34a294823fa62b5
parent bf60addfeb0a225637e6e01aabab5e427799e9d5
Author: Milan Pässler <me@pbb.lc>
Date: Mon, 10 Jun 2019 11:15:14 +0200

foo
4 files changed, 14 insertions(+), 8 deletions(-)
M
src/departures.js
|
1
+
M
src/index.js
|
7
-------
M
src/settings.js
|
12
++++++++++++
M
sw.js
|
2
+-
diff --git a/src/departures.js b/src/departures.js
@@ -139,6 +139,7 @@ class Departures extends LitElement {
 			}
 
 			.table-column:not(.table-heading):not(.table-title) {
+				background: #222;
 				border-bottom: 1px solid grey;
 				color: #ffaa00;
 			}
diff --git a/src/index.js b/src/index.js
@@ -1,10 +1,3 @@
 "use strict";
 
 import "./layout.js";
-
-const sw = navigator.serviceWorker;
-if (sw) {
-	sw.register('sw.js', {
-		scope: './'
-	});
-}
diff --git a/src/settings.js b/src/settings.js
@@ -6,8 +6,20 @@ import "@authentic/mwc-ripple";
 import "./card.js";
 import "./row.js";
 
+const sw = navigator.serviceWorker;
+let registration;
+if (sw) {
+	sw.register('sw.js', {
+		scope: './'
+	}).then((reg) => {
+		registration = reg;
+	});
+}
+
 class Settings extends LitElement {
 	_forceUpdate(evt) {
+		registration.update();
+		location.reload();
 	}
 
 	render() {
diff --git a/sw.js b/sw.js
@@ -9,7 +9,7 @@ let preCache = [
 	'https://fonts.gstatic.com/s/materialicons/v47/flUhRq6tzZclQEJ-Vdg-IuiaDsNc.woff2',
 ];
 
-const CACHE = 'cache-v4';
+const CACHE = 'cache-v5';
 
 self.addEventListener('install', function (evt) {
 	self.skipWaiting();