Skip to content

Instantly share code, notes, and snippets.

@colwem
Last active June 23, 2016 19:17
Show Gist options
  • Save colwem/b29f13a89190cbd6d98d93b493040f87 to your computer and use it in GitHub Desktop.
Save colwem/b29f13a89190cbd6d98d93b493040f87 to your computer and use it in GitHub Desktop.
Promise nesting
Promise = require('bluebird');
promiseOfA.then((a) => {
return usesAPromisesB(a).then((b) => {
return usesAAndB(a, b);
});
});
// or
let promiseOfB = promiseOfA.then((a) => {
return usesAPromisesB(a);
});
Promise.join(promiseOfA, promiseOfB, (a, b) => usesAAndB(a, b));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment