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,
|
||||
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() {
|
||||
callback && callback(cache[req].data);
|
||||
}, 0);
|
||||
|
@ -134,10 +137,11 @@ Ox.Request = function(options) {
|
|||
}
|
||||
|
||||
function callback(data) {
|
||||
if (requests[options.id]) {
|
||||
delete requests[options.id];
|
||||
//Ox.len(requests) == 0 && $body.trigger('requestStop');
|
||||
options.callback && options.callback(data);
|
||||
}
|
||||
}
|
||||
|
||||
function debug(request) {
|
||||
var $iframe = $('<iframe>')
|
||||
|
|
Loading…
Reference in a new issue