aboutsummaryrefslogtreecommitdiffstats
path: root/view
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2021-08-26 18:03:17 +0000
committerMario <mario@mariovavti.com>2021-08-26 18:03:17 +0000
commit6e4c9d684d5fdf9998551c96cdb84e302845a940 (patch)
treeeede5471ae79c75a94e5cbc1e5ecf696f8fc0ef5 /view
parent3ff184f8bb7b6043fdfae12be90d0150cd3d27a1 (diff)
downloadvolse-hubzilla-6e4c9d684d5fdf9998551c96cdb84e302845a940.tar.gz
volse-hubzilla-6e4c9d684d5fdf9998551c96cdb84e302845a940.tar.bz2
volse-hubzilla-6e4c9d684d5fdf9998551c96cdb84e302845a940.zip
port latest pwa work from zap
Diffstat (limited to 'view')
-rw-r--r--view/js/main.js9
1 files changed, 9 insertions, 0 deletions
diff --git a/view/js/main.js b/view/js/main.js
index 68f3415ee..d121913ea 100644
--- a/view/js/main.js
+++ b/view/js/main.js
@@ -34,6 +34,7 @@ if(localStorage.getItem('uid') !== localUser.toString()) {
sessionStorage.clear();
localStorage.setItem('uid', localUser.toString());
}
+
window.onstorage = function(e) {
if(e.key === 'uid' && parseInt(e.newValue) !== localUser) {
if(window_needs_alert) {
@@ -45,6 +46,14 @@ window.onstorage = function(e) {
}
}
+if ('serviceWorker' in navigator) {
+ navigator.serviceWorker.register('/ServiceWorker.js', { scope: '/' }).then(function(registration) {
+ console.log('Service worker registered. scope is', registration.scope);
+ }).catch(function(error) {
+ console.log('Service worker registration failed because ' + error);
+ });
+}
+
$.ajaxSetup({cache: false});
$(document).ready(function() {