Closed krisselden closed 10 years ago
In the case of install, it's not clear who the consumer for the progress is (except the UA which might be showing something like an aggregate progress for all Cache
objects which are contributing to the delay via e.waitUntil()
).
For fetch, it's not clear how to provide it. Underlying network fetch operations have progress, but until the onfetch
handler decides what to respond with, there's no high-fidelity thing you can say you're progressing through, let alone towards.
I can see a case for plumbing the progress from an underlying network fetch via e.respondWith()
, but again, given that the page is the client, that seems like something the UA can do once the connection is made.
What am I missing?
I don't think this applies to fetch event responses, but I see the value in having it for install. In fact, if we don't have this, we're regressing compared to appcache.
I added an install event into the page https://github.com/slightlyoff/NavigationController/blob/master/controller.ts#L45 - we could have controllerinstallprogress.
Progress would be judged by whatever was passed into InstalledEvent#waitUntil. However, this depends on things like Promise.every & cache.ready firing progress events. @slightlyoff, did anything happen with promises and progress events?
We've added:
window.navigator.serviceWorker.oninstall
window.navigator.serviceWorker.oninstallend
window.navigator.serviceWorker.onactivate
window.navigator.serviceWorker.onactivateend
window.navigator.serviceWorker.onerror
These events give you a reference to the worker, so if you need more detailed progress steps, you can use postMessage
.
As for progress events on fetch, I'm going to create another issue for that.
@slightlyoff when building apps that fetch a bunch of stuff on initial load before rendering ("app-like" experiences), it's important to be able to show a progress bar while this process is happening.
This means that the network APIs should have some sort of progress events that you can use. Perhaps it makes sense to standardize a progress event for byte streams?