I have been trying to fetch and update the service worker without having the user interaction. I was able to cache the pagaes, but only upon refresh I was able to fetch the updates build, which requires user interaction. Any help on how could it be done.
Choice of framework: Angular2, sw-precache(Library)
Here is my script in top level
<script>
if ('serviceWorker' in navigator) {
navigator.serviceWorker.register('/service-worker.js').then(function(registration) {
console.log('Service Worker registered');
}).catch(function(err) {
console.log('Service Worker registration failed: ', err);
});
}
</script>