5 send: function(options) {
6 //mootools set onreadystatechange after xhr.open, in webkit, this cause readyState 1 to be never fired
7 if (Browser.Engine.webkit) this.xhr.onreadystatechange = this.onStateChange.bind(this);
8 return this.parent(options);
11 onStateChange: function() {
12 if (this.xhr.readyState == 1) this.dataSent = true;
17 APE.Transport.longPolling = new Class({
19 initialize: function(ape) {
21 this.requestFailObserver = [];
24 send: function(queryString, options) {
25 var request = new Request({
26 url: this.ape.serverUri,
27 onFailure: this.ape.requestFail.bind(this.ape, [-2, this]),
28 onComplete: function(resp) {
29 $clear(this.requestFailObserver.shift());
30 this.ape.parseResponse(resp, options.requestCallback);
35 this.request = request;
37 this.requestFailObserver.push(this.ape.requestFail.delay(this.ape.options.pollTime + 10000, this.ape, [-1, request]));
43 return this.request ? this.request.running : false;
47 if (this.request) this.request.cancel();
48 $clear(this.requestFailObserver.shift());
52 APE.Transport.longPolling.browserSupport = function() { return Browser.Features.xhr ? true : 2; };