anthumchris / fetch-progress-indicators

Progress indicators/bars using Streams, Service Workers, and Fetch APIs
https://fetch-progress.anthum.com/
MIT License
360 stars 36 forks source link

Add Aggregate Download Progress for Multiple Assets #10

Open anthumchris opened 6 years ago

anthumchris commented 6 years ago

A SW could be used to show aggregate/total progress indicators for multiple assets that download individually as part dependencies for a PWA. Video games loading screens are good examples of this. For large downloads that would exceed a few seconds, it would make sense to load the SW first, refresh, and then show progress for multiple assets in transit.

This example should leverage HTTP2 to ensure that totals for all assets are gathered from the onset. Assumption is that multiple responses will come in before downloads complete, and that assumption should be tested with various "total asset" values (i.e. 5, 10, 20, 30). Various browsers and back-end Nginx server may effect the total files that could start to download, hence affecting the "total bytes" aggregate.

This recent originated from a recent StackOverflow question "Show progress while caching files using a service worker"