Fixed getLastModified callback firing three times (once for every readyState change).

This commit is contained in:
Patrick McElhaney 2012-03-19 15:28:41 -03:00
parent 0064595dea
commit af20af8524

View File

@ -44,9 +44,11 @@
http.open('HEAD', location, true);
http.onreadystatechange = function() {
console.log(http);
console.log(http.getResponseHeader('Last-Modified'));
callback(http.getResponseHeader('Last-Modified'));
if(http.readyState === http.DONE) {
console.log(http);
console.log(http.getResponseHeader('Last-Modified'));
callback(http.getResponseHeader('Last-Modified'));
}
};
http.send();
}