Skip to content

Instantly share code, notes, and snippets.

@dustingetz
Created April 16, 2014 22:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dustingetz/10940534 to your computer and use it in GitHub Desktop.
Save dustingetz/10940534 to your computer and use it in GitHub Desktop.
// Not all of the pipeline is async, but some of it is, so even the non-async functions
// get lifted into a promise (a compliant Promises/A+ impl will lift your functions for free)
Q.delay(100)
.then(function (_) { return { a: 1 }})
.then(function (acc) { return _.extend(acc, { b: 2 }); })
.then(function (acc) { return _.extend(acc, { a: acc.a + 1 }); })
.then(_.bind(this.setState, this))
.done();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment