Hacker News new | past | comments | ask | show | jobs | submit login

I wrote a module that provides something similar to this using ES6 generators (which are already widely supported), but also supports callbacks in addition to promises. This way, you can make calls to existing APIs without having to wrap them to return Promises.

https://github.com/mappum/watt

Since it uses generators, you use 'yield' where you would have used 'await'.




I'm not trying to be antagonistic, but I am honestly curious how this differentiates from tj/co?

https://github.com/tj/co


From the bottom of the watt README:

co is similar to watt, but the main difference is that it only works with Promises. It requires that you convert callback functions to return Promises before you can call them, and it does not let you wrap generators with a callback API.




Join us for AI Startup School this June 16-17 in San Francisco!

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

Search: