Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // resolving the promise
- flyToTheMoon.then((asyncResult) => { // then if it was successful
- return asyncResult;
- })
- .then((asyncResult) => { // but we need to make a second async call with the result of the first
- if (asyncResult.needsMoreData) {
- return moreTakeOffData();
- }
- })
- .then((moreData) => { // and another async call
- return startEngine.start(moreData);
- })
- .then((takeoff) => { // and another
- // welcome to Promise-Land
- })
- .catch((error) => {
- console.log('Damn errors');
- });
Add Comment
Please, Sign In to add comment