[API Break] .sequence() and .chainify() now handle multiple `.fulfill()` arguments correctly

5 views
Skip to first unread message

AJ ONeal

unread,
Sep 7, 2010, 1:11:26 PM9/7/10
to futures-j...@googlegroups.com
API docs have been updated on github.

Whine about it now or forever hold your peace. Suggestions welcome. This change 


Futures.sequence

This change removes functionality that was most likely not even used and makes it more useable with nodejs, etc.
For many users this requires no change to code (since `index` and `arr` were fairly useless in the first place)

WAS
Futures.sequence(function (fulfill) {
    fulfill("one argument");
  })
  .then(function (fulfill, result, index, arr) {
    // do stuff
  });

NOW
Futures.sequence(function (fulfill) {
    fulfill("one", "two", "three");
  }).then(function (fulfill, one, two, three) {
    // one === "one"
    // two === "two"
    // three === "three"
  });


Futures.chainify

A one-liner fixes old code

WAS
Futures.chainify(providers, {
  consumer1: function (data, params) {
    // do stuff with `data`
  }
})

NOW
Futures.chainify(providers, {
  consumer1: function (results, params) {
    var data = results[0];
    // do stuff with `data`
  }
})

AJ ONeal

Reply all
Reply to author
Forward
0 new messages