Guest User

Untitled

a guest
Nov 20th, 2017
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. // resolving the promise
  2. flyToTheMoon.then((asyncResult) => { // then if it was successful
  3. return asyncResult;
  4. })
  5. .then((asyncResult) => { // but we need to make a second async call with the result of the first
  6. if (asyncResult.needsMoreData) {
  7. return moreTakeOffData();
  8. }
  9. })
  10. .then((moreData) => { // and another async call
  11. return startEngine.start(moreData);
  12. })
  13. .then((takeoff) => { // and another
  14. // welcome to Promise-Land
  15. })
  16. .catch((error) => {
  17. console.log('Damn errors');
  18. });
Add Comment
Please, Sign In to add comment