In jquery
there is ajaxStar and ajaxStop to listen the ajax event.
how to do that with superagent?
because I'm using React, so I give up jquery, though it has ajax hepler, I do not need any dom manipulation, including jquery looks a kind of waste
http://visionmedia.github.io/superagent/#aborting-requests
You may read the api first.
Seems I did not make myself clear.
the link you show me is just a sentence.

what can this .abort method do with ajaxStar/Stop?
You may read the api first.
after read all the api, I still can not find any api I can use to implement my goal. :cry:
can you look this question in stackoverflow?
http://stackoverflow.com/questions/33219794/superagent-equivalent-of-jquerys-ajaxstart-ajaxstop
the question author is faced with the same problem with me.
I am sorry. I made a mistake.
function stats(req) {
req.once('request', function(){
// ajaxstart
req._startedAt = Date.now();
});
req.once('error', function(){
// an error锛宼he request fail
});
req.once('end', function(){
// ajaxstop
var use = Date.now() - req._startedAt;
});
}
function get(url) {
return request.get(url)
.use(stats);
}
Request.prototype._end = Request.prototype.end;
Request.prototype.end = function(fn) {
this.emit('request');
this._end(fn);
}
wow~
In current superagent, the equivalent functionality would be:
'request' event in place of ajaxStart.end() callback in place of ajaxStopI would consider a PR to have superagent emit an end event (for responses, aborts, and errors) in the same place we invoke the .end() callback so there's a consistent event model without having to mix event handler and callbacks.
Most helpful comment
Seems I did not make myself clear.

the link you show me is just a sentence.
what can this .abort method do with ajaxStar/Stop?
after read all the api, I still can not find any api I can use to implement my goal. :cry:
can you look this question in stackoverflow?
http://stackoverflow.com/questions/33219794/superagent-equivalent-of-jquerys-ajaxstart-ajaxstop
the question author is faced with the same problem with me.