Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | 1x | // eslint-disable-next-line @typescript-eslint/no-unused-vars
import type { makeExoGenerator } from './exo-generator.ts';
// This type is used in the docs.
import { makeRefIterator } from './ref-reader.ts';
/**
* Make an iterator from a remote generator. Intended to be used in conjunction
* with {@link makeExoGenerator}. This is the consuming end of the pair.
*
* Enables async iterator syntax like below.
* ```ts
* const eventualIterator = makeEventualIterator(remoteGeneratorRef);
* for await (const value of eventualIterator) {
* console.log(`A faraway vat yielded: ${value}`);
* }
* ```
*
* @param iteratorRef - The remotable presence to make an iterator from.
* @returns An iterator that wraps the remotable presence, enabling async iterator syntax.
*/
export const makeEventualIterator = makeRefIterator;
|