An open API service indexing awesome lists of open source software.

https://github.com/srowhani/atask

Clean and concise abstractions for working with asynchronous code
https://github.com/srowhani/atask

async generator-function utility

Last synced: 5 days ago
JSON representation

Clean and concise abstractions for working with asynchronous code

Awesome Lists containing this project

README

          

# Async Iterators

## Usage

```ts
function * _sampleIterator(a: number) {
const b = yield new Promise(
r => setTimeout(() => r(a + 1), 1000)
);

const c = yield function * () {
const d = yield b + 1;
yield d + 1;
}

const e = yield () => {
return c + 1
}

return e + 1;
}

const taskInstance = asyncIteratorFactory(_sampleIterator(1));

const result = await taskInstance();
// result = 5
```