Background Geolocation ServiceWorker - onMessage Event order when Web App regains focus : <p>For complete details, and a more lengthy description, please refer to this W3C Service worker <a href="https://github.com/w3c/ServiceWorker/issues/745#issuecomment-304168724" rel="noreferrer">issue</a>.</p>

<p>This is my HTML5 Web App scenario: -</p>

<ul>
<li>My Web App has been backgrounded and stuck in my pocket while I go for a ride</li>
<li>As I clock up the KMs my Service Worker(s) is regularly receiving GPS updates and invoking postMessage() to queue them up for my App to eventually plot on the Google map</li>
<li>At the end of the ride I order a beer and foreground the Web App so I can see where I've been, average speed, and so on.</li>
</ul>

<p>My question are these: -</p>

<p>1) Will the Focus event fire before or after all of the Message events triggered by the ServiceWorkers?</p>

<p>2) If Focus is first will a setTimer(0,backlogCleared) suffice as a heuristic mechanism to establish "all background stuff dealt with"? </p>

<p>3) Is there anyway to collapse the postMessage() messages (al la mode Firebase's push notifications) so that only the last/current message is received?</p>

<p>4) If you have ideas about the permissions required to authorize background geolocation please add them over at W3C.</p>

<p>Cheers and good riding, running, sailing, driving!</p>
