'use strict';

if (navigator.serviceWorker) {
    navigator.serviceWorker.register('./sw.js', {scope: './'})
             .then(() => {
                 location.reload();
             })
             .catch(console.error.bind(console));
}

@@ -47,64 +47,604 @@
     
-navigator.serviceWorker.register('./sw.js', %7Bscope: './'
+const controllerChange = new Promise((resolve) =%3E %7B%0A        navigator.serviceWorker.addEventListener('controllerchange', () =%3E %7B%0A            resolve(navigator.serviceWorker.controller);%0A        %7D);%0A    %7D);%0A    %0A    navigator.serviceWorker.register('./sw.js', %7Bscope: './'%7D)%0A             .then(() =%3E %7B%0A                 return navigator.serviceWorker.ready;%0A             %7D)%0A             .then(() =%3E %7B%0A                 if (navigator.serviceWorker.controller) %7B%0A                     return navigator.serviceWorker.controller;%0A                 %7D%0A                 return controllerChange;%0A             
 %7D)%0A 

update register.js