Fix Ox.Request.cancel(fn) (fixes #2932)

arguments[0] === req inside the forEach callback, so previously this
would throw

    TypeError: arguments[0] is not a function
This commit is contained in:
Will Thompson 2016-06-22 15:49:49 +01:00
parent af610a0df9
commit 869de36163
No known key found for this signature in database
GPG key ID: 3422DC0D7AD482A7

View file

@ -48,8 +48,9 @@ Ox.Request = (function() {
requests = {};
} else if (Ox.isFunction(arguments[0])) {
// cancel with function
var fn = arguments[0];
Ox.forEach(requests, function(req, id) {
if (arguments[0](req)) {
if (fn(req)) {
delete requests[id];
}
});