Usage
Wrap
You can Rx.wrap a reactive (or raw source) in an object for fluent, chainable function calls.
After calling wrap, you can invoke operators directly, for example:
Sources can be another wrapped reactive, a normal reactive, iterable, generator, array or function that returns a value.
For example:
Rx.wrap
can be nice because you get good code-completion and it can be very concise. The downside is that you don’t get access to the individual parts of a flow as easily.
Run
Compose a source and set of operators together as a list with Rx.run . It returns a new reactive that can be subscribed to to read values.
Writable
Rx.run will return a reactive that essentially captures the last operator in the list. It doesn’t make sense to write to this reactive since it represents the tail-end.
If you need to be able to write to the head of a composed flow and read the final result, use Rx.writable . Naturally, the source needs to be a writable one.
It’s also easy enough to do in the following style, where we keep references to all the parts.
Fine-grained
You can work with sources and operators directly.