Re: [whatwg] Provide data chunk with the ProgressEvent

There is something like this cooking in the form of

responseType = "chunked-text"
and
responseType = "chunked-arraybuffer"

For reference, see [1] and [2]. Would be cool to hear a status update on
specifying these. Anyway, apparently the right forum of discussion for this
is the webapps mailing list.

Cheers,
Jussi

[1] http://lists.w3.org/Archives/Public/public-webapps/2011JulSep/0741.html(Jonas'
original suggestion to solve the problem)
[2]
http://lists.w3.org/Archives/Public/public-whatwg-archive/2012Aug/0210.html(my
mail on the same subject as yours)

On Wed, Nov 21, 2012 at 6:07 PM, Nicolas Froidure <froidure_nicolas@yahoo.fr
> wrote:

> I'm currently working on a way to update UI before the all XHR datas to be
> loaded (sample <http://server.elitwork.com/**experiments/pagestream/index.
> **html <http://server.elitwork.com/experiments/pagestream/index.html>>)
>
> For that need i used the progress listener <http://dvcs.w3.org/hg/**
> progress/raw-file/tip/**Overview.html#progressevent<http://dvcs.w3.org/hg/progress/raw-file/tip/Overview.html#progressevent>>
> but it's particularly unadapted to it's use.
>
> Indeed, the only way to access to the data chunk loaded is to keep a
> reference to the previous value of xhr.responseText.
>
> I think it could be more usefull if the progress event was providing a
> chunk property containing only the new datas loaded. So we could do that :
>
> var myXhr=new XMLHttpRequest();
> var mylist=document.**getElementById('mylist');
> myXhr.open("GET", "entries.dat", true);
> myXhr.onprogress=function(**event)
>         {
>         var item=document.createElement('**li');
>         item.innerHTML=event.chunk;
>         myList.appendChild(item);
>         }
> myXhr.send(null);
>
> Instead of :
>
> var myXhr=new XMLHttpRequest();
> var mylist=document.**getElementById('mylist');
> myXhr.open("GET", "entries.dat", true);
> var previousContentLength=0;
> myXhr.onprogress=function()
>         {
>         var item=document.createElement('**li');
>         item.innerHTML=myXhr.**responseText.substr(**
> previousContentLength);
>         previousContentLength=myXhr.**responseText.length;
>         myList.appendChild(item);
>         }
> myXhr.send(null);
>
> Regards, Nicolas Froidure.
>

Received on Wednesday, 21 November 2012 17:48:16 UTC