W3C home > Mailing lists > Public > public-webapi@w3.org > June 2006

a recommendation for the XMLHttpRequest

From: David Arthur <mumrah@gmail.com>
Date: Tue, 13 Jun 2006 16:29:28 -0400
Message-ID: <9e99bb250606131329vf3644fj682729e307cf9c82@mail.gmail.com>
To: public-webapi@w3.org
how about a retry method?

so maybe one could do this.

xhr.open("GET",url,true);
> xhr.onreadystatechange = function(){
> if(xhr.readyState == 4 && xhr.status == 408)
> {
> //code for timeout
> xhr.retry();
> }
> xhr.send(null);


I've been writing some error handling for XHRs and in order to do something
like this, i'm having to make a bunch of extra properties for the class
(getting kinda messy). I thought having a simple way to retry a request
would be nice.

Another possibility would be to let the constructor take on an argument such
that it could clone an existing XHR

var xhr1 = new XMLHttpRequest(xhr0);


Where it would take on the properties of the opener from the cloned XHR -
readyState, status, statusText, etc would be reset. And the readyState
handler would also be not set (as not to get stuck retrying a request ad
nausium).

Just a thought.

-- 
David Arthur
http://enja.org/david
Received on Tuesday, 13 June 2006 20:29:45 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 8 January 2008 14:18:55 GMT