Skip to content
/ atask Public

Clean and concise abstractions for working with asynchronous code

Notifications You must be signed in to change notification settings

srowhani/atask

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Async Iterators

Usage

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

About

Clean and concise abstractions for working with asynchronous code

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published