upload progress events

Hi everyone,

Anne, Ian and I were discussing the fact that the Progress Events  
spec requires duplicates of every event for upload as well as  
download. This makes the spec a fair bit more complicated, especially  
if it ends up specifying a number of different progress events.

As far as I know, this feature is only needed for XMLHttpRequest,  
since it's the only obvious element we can think of that does both  
upload and download, and where it's important to keep the two separate.

However, we thought of a possible alternate design that might cover  
this case better. In brief, the idea is to use the same set of events  
for upload and download, but to provide a separate EventTarget  
attached to the XMLHttpRequest object, which is the target all the  
upload-related events; XHR itself only dispatches the download events.

In practice, it would look like this in code:

xhr.addEventListener('progress', func, false);
xhr.upload.addEventListener('progress', func, false);

However, this becomes much more useful when you have a reusable  
upload/download progress UI control:

var downloadURI = new ProgressUI(xhr);
var uploadUI = new ProgressUI(xhr.upload);

With separate events, you would need either two controls, or a way to  
put the control in a mode where it listens to either only upload or  
only download events.

This would require a change in XHR to adopt the Progress Events spec,  
but would considerably simplify Progress Events. Thoughts?

Regards,
Maciej

Received on Tuesday, 6 March 2007 01:49:16 UTC