JavaScript Illustrated: Promises
medium.com
JavaScript Illustrated: Promises
1–9 of 9 posts
Re: JavaScript Illustrated: Promises
#2`.then()` was fine back in the day, but there's not a good reason to write new code using it in 2019.
Re: JavaScript Illustrated: Promises
#3Re: JavaScript Illustrated: Promises
#4[0] https://dev.to/craigmichaelmartin/the-problem-with-promises-...
Re: JavaScript Illustrated: Promises
#5Odd for an article written in Oct 8 2019, there's no mention of ES2017's `await`. `.then()` was fine back in the day, but there's not a good reason to write new code using it in 2019.
Re: JavaScript Illustrated: Promises
#6Odd for an article written in Oct 8 2019, there's no mention of ES2017's `await`. `.then()` was fine back in the day, but there's not a good reason to write new code using it in 2019.
I don't believe that's true - I haven't had the time to test this yet, but I believe that the scenarios where a power user would prefer to have a then. Await's are definitely easier because they allow you to maintain the "procedural" feel of your code, but promises allow you to kick off several async things at once so that they take place at the same time. For instance, if I have a collection of promises that each ta…
await Promise.all([promise, promise]);
Re: JavaScript Illustrated: Promises
#7Check out "The Problem with Promises in JavaScript" [0] for some gotchas with the design of js promises. [0] https://dev.to/craigmichaelmartin/the-problem-with-promises-...
Re: JavaScript Illustrated: Promises
#8Odd for an article written in Oct 8 2019, there's no mention of ES2017's `await`. `.then()` was fine back in the day, but there's not a good reason to write new code using it in 2019.
I don't believe that's true - I haven't had the time to test this yet, but I believe that the scenarios where a power user would prefer to have a then. Await's are definitely easier because they allow you to maintain the "procedural" feel of your code, but promises allow you to kick off several async things at once so that they take place at the same time. For instance, if I have a collection of promises that each ta…
Array.prototype.forEachAsyncParallel = async function (iterateFunction) {
await Promise.all(this.map(iterateFunction));
}
Note 1: my app, my prototypes.Note 2: read note 1.
Re: JavaScript Illustrated: Promises
#9Odd for an article written in Oct 8 2019, there's no mention of ES2017's `await`. `.then()` was fine back in the day, but there's not a good reason to write new code using it in 2019.