Treats the chain/generator as a promise
const ticker = asPromise(tick({ interval: 1000 }));const x = await ticker(); // Waits for 1000ms before giving a value Copy
const ticker = asPromise(tick({ interval: 1000 }));const x = await ticker(); // Waits for 1000ms before giving a value
This will only ever return one value. To return multiple values, it's necessary to call asPromise and await the result in a loop.
asPromise
await
Treats the chain/generator as a promise
This will only ever return one value. To return multiple values, it's necessary to call
asPromise
andawait
the result in a loop.