Created by: richarddd
This enables users to tell the service worker to skip waiting.
Example:
serviceWorker.register({
...
onWaiting((waitingWorker) => {
waitingWorker.postMessage({ type: "SKIP_WAITING" })
window.location.reload();
})
...
});
This PR also adds check if multiple service workers are registered so only the correct one triggers the callbacks we pass to serviceWorker.register