Does anybody know of a way to employ the functionality of ajaxStop() without the overhead of jQuery? I've tried looking through the source on jQuery's GitHub page, but I'm having trouble finding it or knowing which files to look through.
You could intercept each ajax call and keep track of it yourself. This should give you an idea:
var interceptor = (function(open) {
var activeXhr = [];
XMLHttpRequest.prototype.open = function(method, url, async, user, pass) {
this.addEventListener('readystatechange', function() {
switch(this.readyState){
case 1: // opened request
activeXhr.push(this);
break;
case 4: // request done
var i = activeXhr.indexOf(this);
if(i > -1)
activeXhr.splice(i, 1); // remove finished request
if(!activeXhr.length) // if all requests are done
console.log('ajax stop');
break;
}
}, false);
open.call(this, method, url, async, user, pass);
};
})(XMLHttpRequest.prototype.open);
$.ajax({ url: '/echo/json/', data: { delay: 1 } });
$.ajax({ url: '/echo/json/', data: { delay: 2 } });
$.ajax({ url: '/echo/json/', data: { delay: 3 } });