[...]
.then(registration => {
registration.onupdatefound = () => {
if (navigator.serviceWorker.controller) {
const { installing, update } = registration;
installing.onstatechange = () => {
switch (installing.state) {
case 'installed':
if (navigator.serviceWorker.controller) {
console.log('New or updated content is available.');
update(); // TypeError
} else {
console.log('Content is now available offline!');
}
break;
case 'redundant':
throw new Error('The installing service worker became redundant.');
}
};
}
};
})
[...]
Error Message:
Uncaught (in promise) TypeError: Failed to execute 'update' on 'ServiceWorkerRegistration': Illegal invocation
at ServiceWorker.e.onstatechange (app-f925c92b44.js:2)
Error Message: