Getting started with rxjs

Download rxjs eBook

Remarks

This section provides an overview of what rxjs is, and why a developer might want to use it.

It should also mention any large subjects within rxjs, and link out to the related topics. Since the Documentation for rxjs is new, you may need to create initial versions of those related topics.

Versions

VersionRelease date
RxJS 42015-09-25
RxJS 52016-12-13
RxJS 5.0.12016-12-13
RxJS 5.1.02017-02-01

Installation or Setup

Using a CDN:

<!DOCTYPE html>
<head>
  <script src="https://cdn.jsdelivr.net/rxjs/4.1.0/rx.min.js"></script>
</head>
<body>

  <script>
    // `Rx` is available
    var one$ = Rx.Observable.of(1);
    var onesub = one$.subscribe(function (one) {
      console.log(one); // 1
    });
    // alternatively: subscribe(console.log)
  </script>
</body>
</html>
 

CDN if using RxJS 5 (RC):

<script src="https://npmcdn.com/@reactivex/rxjs@5.0.0-rc.1/dist/global/Rx.js"></script>
 

Using a bundler:

First install into your project directory with npm:

npm install rx
 

Or using RxJS 5 (RC):

npm install rxjs
 

Then, in your JavaScript file:

var Rx = require('rx');
//var Rx = require('rxjs/Rx'); // v5beta 

var one$ = Rx.Observable.of(1);
var onesub = one$.subscribe(function (one) {
  console.log(one); // 1
});
 

If using an es6/2015 compatible bundler:

import Rx from 'rx';
//import Rx from 'rxjs/Rx'; // v5beta

const one$ = Rx.Observable.of(1);
const onesub = one$.subscribe(one => console.log(one)); // 1
 

Stats

240 Contributors: 5
Thursday, March 30, 2017
Licensed under: CC-BY-SA

Not affiliated with Stack Overflow
Rip Tutorial: info@zzzprojects.com

Download eBook