tis-cli前端项目快速搭建命令行工具
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

93 lines
3.4 KiB

4 years ago
  1. # <img src="docs_app/assets/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. ```sh
  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`. And you can pull in any operator you need from one spot, under `'rxjs/operators'`.
  27. ```ts
  28. import { range } from "rxjs";
  29. import { map, filter } from "rxjs/operators";
  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. ### CDN
  38. For CDN, you can use [unpkg](https://unpkg.com/):
  39. [https://unpkg.com/rxjs@^7/dist/bundles/rxjs.umd.min.js](https://unpkg.com/rxjs@%5E7/dist/bundles/rxjs.umd.min.js)
  40. The global namespace for rxjs is `rxjs`:
  41. ```js
  42. const { range } = rxjs;
  43. const { map, filter } = rxjs.operators;
  44. range(1, 200)
  45. .pipe(
  46. filter(x => x % 2 === 1),
  47. map(x => x + x)
  48. )
  49. .subscribe(x => console.log(x));
  50. ```
  51. ## Goals
  52. - Smaller overall bundles sizes
  53. - Provide better performance than preceding versions of RxJS
  54. - To model/follow the [Observable Spec Proposal](https://github.com/zenparsing/es-observable) to the observable
  55. - Provide more modular file structure in a variety of formats
  56. - Provide more debuggable call stacks than preceding versions of RxJS
  57. ## Building/Testing
  58. - `npm run compile` build everything
  59. - `npm test` run tests
  60. - `npm run dtslint` run dtslint tests
  61. ## Adding documentation
  62. 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).