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 valueMultiple return values
Pull/Synchronous/Interactive Object Iterables(Array | Set | Map)
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
IterableObservable
getDataFromLocalMemory()
  .filter (s => s != null)
  .map(s => s + 'transformed')
  .forEach(s => console.log(\`next => ${s}\`))
getDataFromNetwork()
  .filter (s => s != null)
  .map(s => s + 'transformed')
  .subscribe(s => console.log(\`next => ${s}\`))

There are a number of ways of getting started with RxJS including:

Getting Started With RxJS

Getting started with the Reactive Extensions for JavaScript is easy. Let’s start with the basics here:

RxJS Guidelines

Curious on how we designed RxJS? This is covered along with overall guidelines of how your RxJS code should operate. In addition, we have contribution guidelines which set the bar for which we accept contributions.

Getting to Know RxJS Libraries

There are many libraries that make up the Reactive Extensions for JavaScript, so it may be a little daunting at first to know which ones to include. This will serve as a guide for which libraries you might need. For most operations you’ll only need rx.lite.js, but you may find you need more operators, so you start with rx.js and add additional files to mix in functionality as you need it.

The complete library:

Main Libraries:

Lite Libraries:

Core Libraries:

How Do I?

There is a large surface area with the Reactive Extensions for JavaScript, so it might be hard to know where to start. This will serve as a guide to answer some of the more basic questions.

  1. How do I wrap an existing API?
  2. How do I integrate jQuery with RxJS?
  3. How do I integrate Angular.js with RxJS?
  4. How do I create a simple event emitter?

Mapping RxJS from Different Libraries

Converting your existing code from other libraries can be easy. Many of the concepts you already know from popular libraries such as Bacon.js and Async.js

  1. For Bacon.js Users
  2. For Async.js Users
  3. For Highland.js Users

Reactive Extensions Class Library

This section contains the reference documentation for the Reactive Extensions class library.

Helpers

Core

Subjects

Schedulers

Disposables

Testing