how about a retry method?

so maybe one could do this.

xhr.open("GET",url,true);
xhr.>
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

Reply via email to