Skip to content

Instantly share code, notes, and snippets.

@gavri
Last active January 1, 2016 16:29
Show Gist options
  • Save gavri/8171522 to your computer and use it in GitHub Desktop.
Save gavri/8171522 to your computer and use it in GitHub Desktop.
ranju
function foo() {
op1().then(function(result) {
return Q.all([op2(), Q(result)]);
}).then(function(data0, data1) {
// data[0] is context from previous function
// data[1] is data for this call
return Q.all([op3, Q(data1)]);
}).then(function(data1, data2) {
// do something with both the contexts
});
} //test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment