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

I use promises most of the time. In frameworks like koa they even got a bit nicer.

Is there something like this for event systems?

I mean, if I send stuff to the server and wait for it to answer, promises work really well.

But what about things like onClick? The promise can only resolve once.



For this there are Observables and async iterators. I warmly recommend https://channel9.msdn.com/Events/Lang-NEXT/Lang-NEXT-2014/Ke... .

I've also personally been using Rx and RxJS a lot and have been enjoying it a lot over the past few years. Observables and async iterators are both features that are on standards track for the language. See https://github.com/zenparsing/es-observable and https://github.com/Reactive-Extensions/RxJS




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

Search: