Great article. It helped me finally understand serviceWorkers.
After some more digging I started to wonder if it wouldn't be better to avoid storing ServiceWorkerRegistration and retrieve one when needed.
Should I concern that object can "expire" after some longer time?
I came to this:
if ('serviceWorker' in navigator) {
navigator.serviceWorker.ready.then(registration => {
const registrationWaiting = serviceWorkerRegistration?.waiting;
...
});
}
Well yeah, when user doesn't click the Update button then maybe should think about the "expiring". Should test it out. Retriving it when needed probably would be safer solution?
Great article. It helped me finally understand serviceWorkers.
After some more digging I started to wonder if it wouldn't be better to avoid storing ServiceWorkerRegistration and retrieve one when needed.
Should I concern that object can "expire" after some longer time?
I came to this:
Well yeah, when user doesn't click the Update button then maybe should think about the "expiring". Should test it out. Retriving it when needed probably would be safer solution?
I will use your example for now and will see in future if there are any issues with it. If yes I will come back to report it :)