Created
June 7, 2018 14:39
-
-
Save cromwellryan/eec26e35b9fe5ecb4db99b61914dd645 to your computer and use it in GitHub Desktop.
Notes from the Wes Bos workshop at https://seesparkbox.com using https://github.com/wesbos/Web-App-Workshop
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* 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. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
👍