1 # <img src="docs_app/assets/Rx_Logo_S.png" alt="RxJS Logo" width="86" height="86"> RxJS: Reactive Extensions For JavaScript
3 [![CircleCI](https://circleci.com/gh/ReactiveX/rxjs/tree/6.x.svg?style=svg)](https://circleci.com/gh/ReactiveX/rxjs/tree/6.x)
4 [![npm version](https://badge.fury.io/js/%40reactivex%2Frxjs.svg)](http://badge.fury.io/js/%40reactivex%2Frxjs)
5 [![Join the chat at https://gitter.im/Reactive-Extensions/RxJS](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/Reactive-Extensions/RxJS?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
9 ### MIGRATION AND RELEASE INFORMATION:
11 Find out how to update to v6, **automatically update your TypeScript code**, and more!
13 - [Current home is MIGRATION.md](./docs_app/content/guide/v6/migration.md)
15 ### FOR V 5.X PLEASE GO TO [THE 5.0 BRANCH](https://github.com/ReactiveX/rxjs/tree/5.x)
17 Reactive Extensions Library for JavaScript. This is a rewrite of [Reactive-Extensions/RxJS](https://github.com/Reactive-Extensions/RxJS) and is the latest production-ready version of RxJS. This rewrite is meant to have better performance, better modularity, better debuggable call stacks, while staying mostly backwards compatible, with some breaking changes that reduce the API surface.
19 [Apache 2.0 License](LICENSE.txt)
21 - [Code of Conduct](CODE_OF_CONDUCT.md)
22 - [Contribution Guidelines](CONTRIBUTING.md)
23 - [Maintainer Guidelines](doc_app/content/maintainer-guidelines.md)
24 - [API Documentation](https://rxjs.dev/)
26 ## Versions In This Repository
28 - [master](https://github.com/ReactiveX/rxjs/commits/master) - This is all of the current, unreleased work, which is against v6 of RxJS right now
29 - [stable](https://github.com/ReactiveX/rxjs/commits/stable) - This is the branch for the latest version you'd get if you do `npm install rxjs`
33 By contributing or commenting on issues in this repository, whether you've read them or not, you're agreeing to the [Contributor Code of Conduct](CODE_OF_CONDUCT.md). Much like traffic laws, ignorance doesn't grant you immunity.
35 ## Installation and Usage
43 It's recommended to pull in the Observable creation methods you need directly from `'rxjs'` as shown below with `range`. And you can pull in any operator you need from one spot, under `'rxjs/operators'`.
46 import { range } from "rxjs";
47 import { map, filter } from "rxjs/operators";
51 filter(x => x % 2 === 1),
54 .subscribe(x => console.log(x));
57 Here, we're using the built-in `pipe` method on Observables to combine operators. See [pipeable operators](https://github.com/ReactiveX/rxjs/blob/master/doc/pipeable-operators.md) for more information.
61 To install this library for CommonJS (CJS) usage, use the following command:
67 (Note: destructuring available in Node 8+)
70 const { range } = require('rxjs');
71 const { map, filter } = require('rxjs/operators');
74 filter(x => x % 2 === 1),
76 ).subscribe(x => console.log(x));
81 For CDN, you can use [unpkg](https://unpkg.com/):
83 https://unpkg.com/rxjs/bundles/rxjs.umd.min.js
85 The global namespace for rxjs is `rxjs`:
88 const { range } = rxjs;
89 const { map, filter } = rxjs.operators;
93 filter(x => x % 2 === 1),
96 .subscribe(x => console.log(x));
101 - Smaller overall bundles sizes
102 - Provide better performance than preceding versions of RxJS
103 - To model/follow the [Observable Spec Proposal](https://github.com/zenparsing/es-observable) to the observable
104 - Provide more modular file structure in a variety of formats
105 - Provide more debuggable call stacks than preceding versions of RxJS
109 - `npm run build_all` - builds everything
110 - `npm test` - runs tests
111 - `npm run test_no_cache` - run test with `ts-node` set to false
115 Run `npm run build_perf` or `npm run perf` to run the performance tests with `protractor`.
117 Run `npm run perf_micro [operator]` to run micro performance test benchmarking operator.
119 ## Adding documentation
121 We appreciate all contributions to the documentation of any type. All of the information needed to get the docs app up and running locally as well as how to contribute can be found in the [documentation directory](./docs_app).
123 ## Generating PNG marble diagrams
125 The script `npm run tests2png` requires some native packages installed locally: `imagemagick`, `graphicsmagick`, and `ghostscript`.
127 For Mac OS X with [Homebrew](http://brew.sh/):
129 - `brew install imagemagick`
130 - `brew install graphicsmagick`
131 - `brew install ghostscript`
132 - You may need to install the Ghostscript fonts manually:
133 - Download the tarball from the [gs-fonts project](https://sourceforge.net/projects/gs-fonts)
134 - `mkdir -p /usr/local/share/ghostscript && tar zxvf /path/to/ghostscript-fonts.tar.gz -C /usr/local/share/ghostscript`
138 - `sudo add-apt-repository ppa:dhor/myway`
139 - `apt-get install imagemagick`
140 - `apt-get install graphicsmagick`
141 - `apt-get install ghostscript`
143 For Windows and other Operating Systems, check the download instructions here:
145 - http://imagemagick.org
146 - http://www.graphicsmagick.org
147 - http://www.ghostscript.com/