616134ed284a65f26975acb1c1cc0f8e2507058f43ff67fd748cb99fdb831fa849d3411d5f078d6489980b5d6db020cf0a7a85595873a0928de4a8d563a8af 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. # <img src="docs_app/src/assets/images/logos/Rx_Logo_S.png" alt="RxJS Logo" width="86" height="86"> RxJS: Reactive Extensions For JavaScript
  2. ![CI](https://github.com/reactivex/rxjs/workflows/CI/badge.svg)
  3. [![npm version](https://badge.fury.io/js/rxjs.svg)](http://badge.fury.io/js/rxjs)
  4. [![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)
  5. # The Roadmap from RxJS 7 to 8
  6. Curious what's next for RxJS? Follow along with [Issue 6367](https://github.com/ReactiveX/rxjs/issues/6367).
  7. # RxJS 7
  8. ### FOR 6.X PLEASE GO TO [THE 6.x BRANCH](https://github.com/ReactiveX/rxjs/tree/6.x)
  9. 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.
  10. [Apache 2.0 License](LICENSE.txt)
  11. - [Code of Conduct](CODE_OF_CONDUCT.md)
  12. - [Contribution Guidelines](CONTRIBUTING.md)
  13. - [Maintainer Guidelines](docs_app/content/maintainer-guidelines.md)
  14. - [API Documentation](https://rxjs.dev/)
  15. ## Versions In This Repository
  16. - [master](https://github.com/ReactiveX/rxjs/commits/master) - This is all of the current work, which is against v7 of RxJS right now
  17. - [6.x](https://github.com/ReactiveX/rxjs/tree/6.x) - This is the branch for version 6.X
  18. Most PRs should be made to **master**.
  19. ## Important
  20. 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.
  21. ## Installation and Usage
  22. ### ES6 via npm
  23. ```shell
  24. npm install rxjs
  25. ```
  26. It's recommended to pull in the Observable creation methods you need directly from `'rxjs'` as shown below with `range`.
  27. If you're using RxJS version 7.2 or above, you can pull in any operator you need from the same spot, `'rxjs'`.
  28. ```ts
  29. import { range, filter, map } from 'rxjs';
  30. range(1, 200)
  31. .pipe(
  32. filter(x => x % 2 === 1),
  33. map(x => x + x)
  34. )
  35. .subscribe(x => console.log(x));
  36. ```
  37. If you're using RxJS version below 7.2, you can pull in any operator you need from one spot, under `'rxjs/operators'`.
  38. ```ts
  39. import { range } from 'rxjs';
  40. import { filter, map } from 'rxjs/operators';
  41. range(1, 200)
  42. .pipe(
  43. filter(x => x % 2 === 1),
  44. map(x => x + x)
  45. )
  46. .subscribe(x => console.log(x));
  47. ```
  48. ### CDN
  49. For CDN, you can use [unpkg](https://unpkg.com/):
  50. [https://unpkg.com/rxjs@^7/dist/bundles/rxjs.umd.min.js](https://unpkg.com/rxjs@%5E7/dist/bundles/rxjs.umd.min.js)
  51. The global namespace for rxjs is `rxjs`:
  52. ```js
  53. const { range } = rxjs;
  54. const { filter, map } = rxjs.operators;
  55. range(1, 200)
  56. .pipe(
  57. filter(x => x % 2 === 1),
  58. map(x => x + x)
  59. )
  60. .subscribe(x => console.log(x));
  61. ```
  62. ## Goals
  63. - Smaller overall bundles sizes
  64. - Provide better performance than preceding versions of RxJS
  65. - To model/follow the [Observable Spec Proposal](https://github.com/zenparsing/es-observable) to the observable
  66. - Provide more modular file structure in a variety of formats
  67. - Provide more debuggable call stacks than preceding versions of RxJS
  68. ## Building/Testing
  69. - `npm run compile` build everything
  70. - `npm test` run tests
  71. - `npm run dtslint` run dtslint tests
  72. ## Adding documentation
  73. 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).