Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

The problem with Javascript generators, however, is that you're not allowed to call other functions from them, which yield. This very much limits the kind of async stuff you can do with them.


Not really (at least not the kind of stuff I mentioned), those functions can just return promises which the caller yields: http://codepen.io/anon/pen/WvzGLa

Granted async/await syntax will make this a bit nicer:

    async function funcA() {
      await sleep(1000);
      // ...


But then the called functions have to be written async style.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: