cujojs / most

Ultra-high performance reactive programming
MIT License
3.5k stars 231 forks source link

Support the async iteration proposal #481

Closed ghost closed 6 years ago

ghost commented 6 years ago

It would be useful if most.generate supports Async generator functions.

For example:

async function* readLines(path) {
  let file = await fileOpen(path);

  try {
    while (!file.EOF) {
      yield await file.readLine();
    }
  } finally {
    await file.close();
  }
}

most.generate(readLines, path) // returns a Stream of lines
briancavalier commented 6 years ago

Hey @ray851107, thanks for the suggestion. Rather than having generate() support two types of things, and given that Async Iteration is still just a stage-3 (last I checked), I think this would make a great community lib.

Would you be up for contributing?

ghost commented 6 years ago

Sure!

briancavalier commented 6 years ago

Awesome, thank you. Have a look at @most/package-starter as a project starting point, with our standard tooling, etc. and feel free to drop by gitter if you have any questions.

I'll close this issue, but feel free to continue discussion here as well.

ghost commented 6 years ago

Hi @briancavalier , I created a package at https://github.com/ray851107/most-async-iterable

Should I move the repo to most-community?

briancavalier commented 6 years ago

Nice work, @ray851107. It looks really cool.

Open an issue in the mostjs-community/about repo asking to become a member of the GitHub org, and we'll send you an invite. Once you've accepted the invite, you can transfer the repo into the mostjs-community org. After you transfer it, you'll still retain ownership of the repo.

Just to be clear: it's entirely voluntary. You're absolutely welcome to keep the repo in your personal GitHub account. The benefits of transferring it are more visibility, and potentially more feedback from the community.

Cheers, and thanks for contributing!