The Reactive Extensions for JavaScript (RxJS) V2.0 now released

Hot on the heels of the announcement of the availability of the Reactive Extensions for .NET v2.0 RTM, we are pleased to announce the release of the Reactive Extensions for JavaScript (RxJS) v2.0 RTM.  This release, just as in previous releases, strives to maintain parity with the Reactive Extensions for .NET as much as possible, minus such things as the blocking operators.  This is a major milestone in the life of the RxJS, including shipping source that you can use for debug purposes.

This post will focus on what’s inside and how you can get started.

Getting the Reactive Extensions for JavaScript

The Reactive Extensions for JavaScript consists of a number of files, which you can include based upon the functionality you want.  This keeps the size of your includes down significantly, where you may only end up using a few of the many Observable operators we support.  Currently, we ship three variations of each file, a source version, a Visual Studio Documentation (VSDoc) version and the minimized version.

RxJS consists of the following files and we’ll cover the details of each in subsequent posts:

  • rx.js – the  main library for the Reactive Extensions
  • rx.aggregates.js – aggregation operators such as min/max, count, sum, and average
  • rx.binding.js – binding operators such as multicast, publish and replay
  • rx.coincidence.js – coincidence operators such as join, and groupJoin
  • rx.experimental.js – experimental operators such as the imperative operators and forkJoin
  • rx.joinpatterns.js – join pattern calculus implementation
  • rx.testing.js – used to write unit tests for complex processing queries
  • rx.time.js – time-based event processing query operations

You have a number of ways of getting RxJS including a direct download from MSDN, NuGet NPM via Node.js, and as well on our GitHub page.

Installing with NuGet

The first option of getting RxJS is through NuGet.  Starting with Visual Studio 2012, NuGet is automatically built in, but for previous versions you can install via  We have a number of packages in NuGet which correspond to the names of our files from above.  Each package contains the source file, as well as the documentation via a VSDoc file, and a minimized version. 

We ship the following packages in NuGet:

  • RxJS-All
  • RxJS-Main
  • RxJS-Aggregates
  • RxJS-Binding
  • RxJS-Coincidence
  • RxJS-Experimental
  • RxJS-JoinPatterns
  • RxJS-Testing
  • RxJS-Time

In addition to these main packages, we will continue to deliver the bridges to other libraries such as jQuery, Dojo, MooTools, ExtJS and more.  Just search for RxJS-Bridges to find them all.

Installing with NPM and Node.js

In this release we’ve also made the Reactive Extensions for JavaScript available through NPM, a package manager built on the popular Node.js platform.   With this past release, we’ve made an effort to make sure the Reactive Extensions for JavaScript works great on Node.js.  We’ve worked on modularization where you can include all of RxJS including all the operators all the files such as aggregates, binding, time, and more.  

To get started, just install rx from NPM from a command window. 

 > npm install rx

Once installed, you can reference RxJS like the following example of returning a single value and then writing the value to the console when we subscribe.

 // Reference main Rx
 var Rx = require('rx');
 var observable = Rx.Observable.returnValue(42);
 var subscription = observable.subscribe( function (value) {

RxJS, with its emphasis on querying streams of data, is really well suited for Node.js applications. We’ll explore more of RxJS and Node.js in subsequent posts


Asynchronous Module Definition (AMD) support

Modularity is important for many JavaScript developers as code bases in JavaScript become larger, we look for ways of modularizing our code bases and loading only what we need.  One emerging format for modularity has emerged in Asynchronous Module Definition (AMD) which provides a way for JavaScript developers to build modularity into your web based applications.  The AMD format has been embraced by such libraries as jQuery, Dojo, MooTools and now, RxJS.

In the following example, we can use Require.js to load both the main RxJS library as well as the time-based operators to build a simple observable sequence which writes to the console every half second.

 // Require both core and time-based operators
 require(['rx', 'rx.time'], function (Rx) {
     // Print a value every 500ms
     var subscription = Rx.Observable
         .interval(500 /* ms */)
         .subscribe( function (x) {

How Do I Get Started…

One of the often asked questions when it comes to RxJS is how one gets started using the library.  This To that end, we’ve created a GitHub repository especially for our samples called RxJS-Examples.  This is just a sampling of some of the examples we have which highlight some of the Reactive Extensions capabilities.

  • Autocomplete (source) (demo)

    An autocomplete scenario which throttles typing to query Wikipedia for search suggestions.

  • Canvas Painting (source) (demo)

    Painting on a HTML5 Canvas.

  • Drag and Drop (source) (demo)

    Drag and Drop example with the Volta logo.

  • AMD and Require.js Integration (source) (demo)    
    Integration of the Asynchronous Module Definition pattern, Require.js and RxJS.

  • Time Flies Like an Arrow (source) (demo)

    A time based delay for each letter based upon its position .

  • Testing using QUnit (source) (demo)    
    Unit testing example using QUnit showing how you can test the timing aspects of observable sequences.

  • Testing using Node.js and Mocha (source)

    Unit testing example with Mocha and Node.js, which shows how to test the timings of observable sequences.

This is just the start of some of the samples and we’ll be posting more in the near future as well as more complete documentation.


We hope you enjoy the Reactive Extensions for JavaScript V2.0!  Stay tuned to this blog for more in the coming weeks and check out our samples on how you can get started with RxJS.