4 ms·
If you're just rewriting these Promises because the syntax is too verbose, you might be interested in checking out async/await as another alternative; I just re
by kjaer 9y ago
If you're just rewriting these Promises because the syntax is too verbose, you might be interested in checking out async/await as another alternative; I just rewrote some Promises to that recently, and it's really, really nice. Of course, if you prefer RX Observables, go right ahead :)
- coding123 9y agoThanks for the note, I am looking into it right now. One area that may grind my head with async await however is that there is a lot of Promise.all work in this codebase. Would you still use async/await constructs when you need to do a lot of fork/join/merge stuff? (sorry for the derail HN)
- kjaer 9y agoIf you're using Promise.all to run code in parallel, then async await can't really replace that, as far as I know. But you can still use `await Promise.all(...)`, which will free you from having callbacks everywhere; running parallel code will no longer have to look so different from running it sequentially, which is quite nice.
- Longwelwind 9y agoYes, of course ! https://jsfiddle.net/0wc0vjw2/1/ https://jsfiddle.net/0wc0vjw2/1/