[w3c/ServiceWorker] No good way to beacon during activate (#1336)

There currently doesn't seem to be a good way to fire a tracking beacon from the activate step. One use case would be tracking how quickly new versions of the service worker are actually activated (vs installed). Current options I can think of for beaconing during activate:

1. `waitUntil(fetch('/beaconEndpoint'))` This is not good because now all fetch events are temporarily blocked until `fetch('/beaconEndpoint')` completes.
2. `fetch('/beaconEndpoint')` (without `waitUntil`) kicking off async operations outside of `waitUntil` is not great. Might usually work but seems like it could have unwanted side effects or not be completely reliable, depending on the implementation.

What if we supported `sendBeacon` for service worker? I believe this would solve the problem. 

Another option is to allow some way to schedule a task that doesn't block the event from completing. This would open up a big can of worms though, probably not ideal.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3c/ServiceWorker/issues/1336

Received on Wednesday, 18 July 2018 00:29:36 UTC