Commit cdad6cd7 authored by Tristan Cavelier's avatar Tristan Cavelier

Promise.timeout correct context are now assigned to called functions

parent 6a331465
......@@ -325,14 +325,14 @@ Promise.timeout = function (item, timeout) {
var next = new Promise(), solver, i;
solver = next.defer();
i = setTimeout(function () {
solver.reject.apply(next, [new Error("Timeout")]);
solver.reject(new Error("Timeout"));
}, timeout);
Promise.when(item, function () {
clearTimeout(i);
solver.resolve.apply(next, arguments);
solver.resolve.apply(solver, arguments);
}, function () {
clearTimeout(i);
solver.reject.apply(next, arguments);
solver.reject.apply(solver, arguments);
});
return next;
};
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment