aboutsummaryrefslogtreecommitdiffstats
path: root/view
diff options
context:
space:
mode:
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() {