3 ms·
The fact there isn't a straightforward back-pressure mechanism in browsers to get live updates on how much time is left for an upload or a download is why loadi
by onion2k 5y ago
The fact there isn't a straightforward back-pressure mechanism in browsers to get live updates on how much time is left for an upload or a download is why loading spinners are used everywhere instead of progress bars. You can implement it yourself using websockets and a ton of complexity, but then you need the entire socket tooling and security to be in place. It's one of few the things browsers are really missing in my opinion.
- maccolgan 5y agoYou don't need websockets to simply listen to the ProgressEvent, you should know that. https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/progress_event https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequ...
- onion2k 5y agoThat tells you something is happening, and how much has been done, but not how much work there is left to do, or how much back pressure (load) there is on the server side. Consequently you can't work out how far along the progress is or how long is left. If you assume that there'll be a consistent amount of progress you can guess, but for a large upload (eg gigabytes) you'll usually be wrong. If the server could send data back to update the progress event it would be really nice. Right now though, that can't be done (as far as I know.. maybe there's a way now.. I haven't looked for years.)