Newer version available
You’re viewing the API reference for version 3.0.3, but the latest version is 3.1.0. The latest version include may important updates and fixes.
View Latest Versionfunction all
thefrontside/effectionfunction all<T extends readonly Operation<unknown>[] | []>(ops: T): Operation<All<T>>
Block and wait for all of the given operations to complete. Returns an array of values that the given operations evaluated to. This has the same purpose as Promise.all.
If any of the operations become errored, then all
will also become errored.
Example
import { all, expect, main } from 'effection';
await main(function*() {
let [google, bing] = yield* all([
expect(fetch('http://google.com')),
expect(fetch('http://bing.com')),
]);
// ...
});
Type Parameters
T extends readonly Operation<unknown>[] | []
Parameters
ops: T
a list of operations to wait for
Return Type
Operation<All<T>>
the list of values that the operations evaluate to, in the order they were given