3.3 Выполнение задач параллельно
The yield
statement is great for representing asynchronous control flow in a linear style, but we also need to do things in parallel. We can't write:
Because the 2nd effect will not get executed until the first call resolves. Instead we have to write:
When we yield an array of effects, the generator is blocked until all the effects are resolved or as soon as one is rejected (just like how Promise.all
behaves).
Last updated