Commit 814d101b authored by Tristan Cavelier's avatar Tristan Cavelier

promy join and choose cancels promises when cancel method exist

parent d15716c6
...@@ -642,9 +642,11 @@ ...@@ -642,9 +642,11 @@
function cancel() { function cancel() {
var j; var j;
for (j = 0; j < promises.length; j += 1) { for (j = 0; j < promises.length; j += 1) {
if (typeof promises[j].cancel === 'function') {
promises[j].cancel(); promises[j].cancel();
} }
} }
}
deferred = new Deferred(cancel); deferred = new Deferred(cancel);
function succeed(j) { function succeed(j) {
return function (answer) { return function (answer) {
...@@ -691,9 +693,11 @@ ...@@ -691,9 +693,11 @@
function cancel() { function cancel() {
var j; var j;
for (j = 0; j < promises.length; j += 1) { for (j = 0; j < promises.length; j += 1) {
if (typeof promises[j].cancel === 'function') {
promises[j].cancel(); promises[j].cancel();
} }
} }
}
deferred = new Deferred(cancel); deferred = new Deferred(cancel);
function succeed(answer) { function succeed(answer) {
cancel(); cancel();
......
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