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

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.




Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

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

Search: