javascript - Can I guarantee that onreadystatechange will eventually always get called with readyState == 4? -
I am using XMLHttpRequest on an embedded device that provides non-standard extensions for the API from which the request is completed has gone.
Can I assume that, for all cases (successful or otherwise, such as 404, DNS lookup fails, etc.), the result of the call method () to send is finally ready for my on-theradetech handler Calling with == 4?
Or, to keep it in another way, assuming that this implementation XHR behaves like standard browsers in all other ways, the following code will always be destroyed () the method is being called ?
var xhr = new XMLHttpRequest (); Xhr.onreadystatechange = function () {if (xhr.readyState == 4) {callback (xhr.responseText); If (xhr.destroy) {// it should call memory leak xhr.destroy () to stop; }}}; Xhr.open (method, url, true); Xhr.send (zero);
no
For example, in some cases, abort () , the state may end on (3.6.5). During the "normal" operation, if an error occurs and an exception is thrown, the state may end up on anything other than complete . Read more for more information.
Comments
Post a Comment