Reputation: 10614
I have a functional progressive web app. In it to upload data I'm first caching it in IndexDB
and then uploading it and if the upload is successful delete the data from IndexDB
. Now, I want to reload the page once the data is deleted. Is there any way to achieve this outside the main thread(ie. form service worker)?
NOTE:window
object is not accessible in service worker.
Upvotes: 0
Views: 515
Reputation: 2058
You have to communicate first with your page over the postMessage function, then you can access window and reload the page. Here you can find a good description:
http://craig-russell.co.uk/2016/01/29/service-worker-messaging.html#.WgxuSmjWzIU
Upvotes: 2