Access localStorage from service worker
<p>I want to periodically call an API from my service worker to send data stored in the <code>localStorage</code>. This data will be produced and saved in <code>localStorage</code> when a user browses my website. Consider it something like saving stats in <code>localStorage</code> and sending it periodically through the service worker. How should I do this? I understand that I can't access <code>localStorage</code> from the service worker and will have to use the <code>postMessage</code> API. Any help would be highly appreciated.</p>