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
- Host: GitHub
- URL: https://github.com/srowhani/atask
- Owner: srowhani
- Created: 2018-09-22T15:17:00.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2019-01-09T18:11:05.000Z (over 7 years ago)
- Last Synced: 2025-12-30T05:26:25.662Z (4 months ago)
- Topics: async, generator-function, utility
- Language: TypeScript
- Homepage:
- Size: 103 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
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
```