RxJS v4.0
Reactive Extensions (Rx) is a library for composing asynchronous and event-based programs using observable sequences and LINQ-style query operators.
Data sequences can take many forms, such as a stream of data from a file or web service, web services requests, system notifications, or a series of events such as user input.
Reactive Extensions represents all these data sequences as observable sequences. An application can subscribe to these observable sequences to receive asynchronous notifications as new data arrive.
RxJS has no dependencies which complements and interoperates smoothly with both synchronous data streams such as iterable objects in JavaScript and single-value asynchronous computations such as Promises as the following diagram shows:
Single return value | Mutiple return values | |
---|---|---|
Pull/Synchronous/Interactive | Object | Iterables (Array | Set | Map | Object) |
Push/Asynchronous/Reactive | Promise | Observable |
To put it more concretely, if you know how to program against Arrays using the Array#extras, then you already know how to use RxJS!
Example code showing how similar high-order functions can be applied to an Array and an Observable
Iterable | Observable | ||
---|---|---|---|
|
|