Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Notes from the Wes Bos workshop at https://seesparkbox.com using https://github.com/wesbos/Web-App-Workshop
/* Wes' original example is great, but we've found the following
* example of https://github.com/wesbos/Web-App-Workshop/blob/master/notes/02%20-%20Promises.md
* to read really well and keep us from putting too much in our `then` functions.
*/
const logError = (err) => console.log('Something Happened!', err);
getTheWeatherFor('Dayton')
.then(getPicturesOfWeather)
.then(resizePicturesOfWeather)
.then(uploadNewPictures)
.then(console.log)
.catch(logError);
/* Reason:
* We can do this, because `(data) => func(data)` is creating an anonymous
* function with the same signature (shape) as `func(data)`. You don't need
* to wrap the `func(data)` call in an anonymous function.
@davekiss

This comment has been minimized.

Copy link

commented Jun 7, 2018

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.