kefirjs / kefir

A Reactive Programming library for JavaScript
https://kefirjs.github.io/kefir/
MIT License
1.87k stars 97 forks source link

fromNodeCallback ? #21

Closed mbalex99 closed 9 years ago

mbalex99 commented 9 years ago

I understand there is some inspiration from Baconjs.

Is there an interest to implement the "fromNodeCallback" method, so nodejs projects can integrate it with nodejs style async methods?

Looking at bacon, it seems straightforward:

Bacon.fromNodeCallback = liftCallback "fromNodeCallback", (f, args...) ->
    Bacon.fromBinder (handler) ->
     makeFunction(f, args)(handler)
     nop
   , (error, value) ->
     return [new Error(error), end()] if error
     [value, end()]
rpominov commented 9 years ago

We need errors support for this (same as for https://github.com/pozadi/kefir/issues/10)

mbalex99 commented 9 years ago

Ah understood! That's right. Noticed it just now. Thanks!