function showOfflineToast() {
	if (navigator.serviceWorker) {
  		navigator.serviceWorker.register('/sw.js').then(function(reg) {
      		if (!reg.installing) return;
      		console.log("[*] ServiceWorker is installing...");
       		var worker = reg.installing;
 			worker.addEventListener('statechange', function() {
          		if (worker.state == 'redundant') {
              		console.log('[*] Install failed');
          		}
          		if (worker.state == 'installed') {
              		console.log('[*] Install successful!');
          		}
          		if (worker.state == 'activated' && !navigator.serviceWorker.controller) {
            		setInterval(showOfflineToast(),30);
          		}
      		});
  		});
	}
}

@@ -1,70 +1,41 @@
-function showOfflineToast() %7B%0A%09if (navigator.serviceWorke
+if('serviceWorker' in navigato
 r) %7B%0A  
-%09%09
 navi
@@ -94,189 +94,67 @@
 (reg
-) %7B%0A      %09%09if (!reg.installing) return;%0A      %09%09console.log(%22%5B*%5D ServiceWorker is installing...%22);%0A       %09%09var worker = reg.installing;%0A %09%09%09worker.addEventListener('st
+istration) %7B%0A    // Registration was successful%0A  %7D).c
 at
-e
 ch
-ange', 
+(
 func
@@ -158,24 +158,27 @@
 unction(
+err
 ) %7B%0A    
       %09%09
@@ -173,404 +173,99 @@
     
-      %09%09if (worker.state == 'redundant') %7B%0A              %09%09console.log('%5B*%5D Install failed');%0A          %09%09%7D%0A          %09%09if (worker.state == 'installed') %7B%0A              %09%09console.log('%5B*%5D Install successful!');%0A          %09%09%7D%0A          %09%09if (worker.state == 'activated' && !navigator.serviceWorker.controller) %7B%0A            %09%09setInterval(showOfflineToast(),30);%0A          %09%09%7D%0A      %09%09%7D
+// registration failed :(%0A    console.log('ServiceWorker registration failed: ', err
 );%0A  
-%09%09
 %7D);%0A
-%09%7D%0A
 %7D%0A

Update web-application.js