Skip to content

Conversation

frsdcorp
Copy link

We want to send requests any change event without delay.
But some requests (with 2-3-4 characters) processing much longer, than requests with many letters, so we abort previous xhr request to avoid previously sent callbacks.

Мурашкин Александр added 2 commits July 15, 2016 16:00
Aborting previous xhr while making new request
@jlbooker jlbooker added this to the v0.11.3 milestone Nov 1, 2016
@jlbooker jlbooker modified the milestones: v1.1.0, v1.2.0 Dec 21, 2016
} else {
pendingRequestsCount++;
pendingRequests[fingerprint] = this._send(o).done(done).fail(fail).always(always);
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this works for me ...

                    pendingRequestsCount++;
                    if (o.abortLastRequest) {
                        o.beforeSend = function() {
                            if (lastXhrRequest) {
                                lastXhrRequest.abort();
                            }
                        };
                        pendingRequests[fingerprint] = this._send(o).done(done).fail(fail).always(always);
                        lastXhrRequest = pendingRequests[fingerprint];
                    } else {
                        pendingRequests[fingerprint] = this._send(o).done(done).fail(fail).always(always);
                    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants