Echo JS 0.11.0

ndks 1021 days ago. link 2 points
Hey, thanks for the share. Where I haven't used Rx per se, I used Bacon extensively at my last gig.

Rx is a module, and you're merging `plus$` and `minus$` to 'Rx.Observable' - is there an issue of having these bindings persist when the React component unmounts? What would be the best practice for tidying up in `componentWillUnmount`?


gschambers 1021 days ago. link 2 points
Calling `subscribe` on an observable returns a subscription that can be disposed at a later time. The approach that I use is something like this:

If you are subscribing to multiple observables in a single component, you could also consider using `CompositeDisposable`, which allows you to merge multiple subscriptions into a single disposable.
ndks 1020 days ago. link 1 point
Cool, thanks for the clarification.

I guess I should read a bit of the Rx API docs, but doesn't seem far off Bacon with `combineTemplate`; which from memory returns a curried function to end any streams. Someone correct me if I'm wrong.
zarr2k 1021 days ago. link 1 point
There very much is - without having dug deeper, this doesn't look like a complete answer, but merely serves as an introduction on how to begin using it.

You should definately unregister your event listeners in componentWillUnmount. If you wanted to pursue this approach I would probably make a higher level component (or mixin) to declaretively and automatically handle the binding and unbinding of events, plus the glue to rxObservables.
goblinking 1019 days ago. link -1 point
RxJS provides this consideration with dispose() for many ephemeral Observables.  Keep track of your subscriptions and dispose in `componentWillUnmount`.

e: better data above.