4 ms·
It's a trivial matter to wrap promise/all in a core.async channel, providing the exact orginzation pattern you're looking for.
by Skinney 11y ago
It's a trivial matter to wrap promise/all in a core.async channel, providing the exact orginzation pattern you're looking for.
- ilostmykeys 11y agoShow me the code! Go ahead and let's see how pretty that is, and son't forgeg error handling and concurrency.
- Skinney 11y agoI've provided all the code you need to put the pieces together quite trivially. Using go-catching, <? and the promise library (or just the core.async snippet I wrote earlier), you should be able to write the following: (go-catching (<? (async-all [asyncOpA asyncOpB asyncOpC]))) And yes, that handles errors exactly like synchronous code does. The total number of lines for implementing go-catching, <? and async-all shouldn't take more than 20-30 loc, if not less. Now, if 20-30 loc is too much for you to write, then by all means use JS.