Effection Logo

function allthefrontside/effection

function 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