1

I'm new to generators and having a hard time finding an example of how to fire off multiple async calls with generators + native promises

so far I have in a sudo code format

function *getData (){
var data = yeild makeAPICall ();
}

function makeAPICall (){
  async code
  return async code
}

How would I structure my code if I wanted to make multiple calls to makeAPICall in parallel using native javascript promises.

Austin Davis
  • 3,516
  • 10
  • 27
  • 47
  • Aww, the duplicate really is a totally different question, though it asks for exactly the same thing (how to parallelise promise execution in generators) - you couldn't have found it. – Bergi Mar 06 '15 at 03:06
  • I think it's kind of a stretch to mark this as a duplicate as the context is different ie a koajs app which uses the co library, vs bluebird. I think answering this question would be more helpful then having to look at the other question and trying to figure out how it relates to this question. not a big deal, just my $0.02. – James Moore Mar 06 '15 at 03:57
  • The "duplicate" answer includes how to use native generators not co and using the bluebird library not native javascript promises. – Austin Davis Mar 08 '15 at 05:01

0 Answers0