In my code, I am calling the function SigWebRefresh
at specific intervals of 50
milliseconds.
tmr = setInterval(SigWebRefresh, 50);
The function SigWebRefresh
utilizes XMLHTTPRequest
:
function SigWebRefresh(){
xhr2 = new XMLHttpRequest();
xhr2.open("GET", baseUri + "SigImage/0", true );
xhr2.responseType = "blob";
xhr2.onload = function (){
var img = new Image();
img.src = getBlobURL(xhr2.response);
img.onload = function (){
Ctx.drawImage(img, 0, 0);
revokeBlobURL( img.src );
img = null;
}
}
xhr2.send(null);
}
To stop the interval set by setInterval()
, I have used the clearInterval
method like this:
clearInterval(tmr);
Although xhr2.abort();
can abort one instance of the XMLHttpRequest, I am looking for a way to abort all uncompleted XmlHttpRequest
. How can I achieve this?