How do I poll the server every minute to check the service worker update?
I have used the available method of SWUpdate angular, but it doesn't poll the server, instead it fetched the updates and caches when the page is refreshed which is not required.
I came across checkForUpdate() method, which does quite similar, but not sure of how it works?
Any of the help would be appreciated.
ngOnInit(){
if(this.swUpdate.isEnabled){
this.swUpdate.available.subscribe( () => {
if(confirm("New Version available.. Load?")){
window.location.reload();
}
})
}
}
Above code which fetches the data from cache on the second reload.