don't call callbacks of cancelled requests
This commit is contained in:
parent
851aa386c0
commit
02838540db
1 changed files with 8 additions and 4 deletions
|
@ -115,7 +115,10 @@ Ox.Request = function(options) {
|
||||||
url: options.url,
|
url: options.url,
|
||||||
data: options.data
|
data: options.data
|
||||||
};
|
};
|
||||||
if (cache[req] && (options.age == -1 || options.age > Ox.getTime() - cache[req].time)) {
|
if (cache[req] && (
|
||||||
|
options.age == -1
|
||||||
|
|| options.age > +new Date() - cache[req].time
|
||||||
|
)) {
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
callback && callback(cache[req].data);
|
callback && callback(cache[req].data);
|
||||||
}, 0);
|
}, 0);
|
||||||
|
@ -134,9 +137,10 @@ Ox.Request = function(options) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function callback(data) {
|
function callback(data) {
|
||||||
delete requests[options.id];
|
if (requests[options.id]) {
|
||||||
//Ox.len(requests) == 0 && $body.trigger('requestStop');
|
delete requests[options.id];
|
||||||
options.callback && options.callback(data);
|
options.callback && options.callback(data);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function debug(request) {
|
function debug(request) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue