Reactive Extensions for JS
- Observables
- Observable
- Flowable
- Maybe
- Single
- Completable
- Subjects
- ObservableSubject
- MaybeSubject
- SingleSubject
- CompletableSubject
- Scheduler
- Cancellable
All Observables are extended in this package to allow observable conversion, and other features.
- NPM
npm i reactive-extensions
-
CDN
- jsDelivr
<script src="https://cdn.jsdelivr.net/npm/is-reactive-streams/dist/index.min.js"></script> <script src="https://cdn.jsdelivr.net/npm/rx-cancellable/dist/index.min.js"></script> <script src="https://cdn.jsdelivr.net/npm/rx-scheduler/dist/index.min.js"></script> <script src="https://cdn.jsdelivr.net/npm/rx-maybe/dist/index.min.js"></script> <script src="https://cdn.jsdelivr.net/npm/rx-single/dist/index.min.js"></script> <script src="https://cdn.jsdelivr.net/npm/rx-completable/dist/index.min.js"></script>
- unpkg
<script src="https://unpkg.com/is-reactive-streams/dist/index.min.js"></script> <script src="https://unpkg.com/rx-cancellable/dist/index.min.js"></script> <script src="https://unpkg.com/rx-scheduler/dist/index.min.js"></script> <script src="https://unpkg.com/rx-maybe/dist/index.min.js"></script> <script src="https://unpkg.com/rx-single/dist/index.min.js"></script> <script src="https://unpkg.com/rx-completable/dist/index.min.js"></script>
There is already an existing ReactiveX implementation in JS called RxJS. reactive-extensions
does not intend to replace RxJS, as this library was meant for educational purposes but evolved into a library that can be used for production. You can use either of two, but both libraries does not interop with one another.
Below is the comparison table between reactive-extensions
and RxJS
Behavior | reactive-extensions | RxJS |
---|---|---|
Code | Written in pure JavaScript. | Written in TypeScript. |
Observable Extensions | Supports Maybe , Single , Completable and Flowable |
None |
Operator Composition | Can both wrap the Emitter (through compose ) and the Observer (through lift ). |
Wraps the Subscriber . |
Operators | Bundled with their respective classes. Other operators returns a different type of Observable. | Exportable as an individual module. |
Pipelines | Using compose . |
Using pipe |
Subscription | Uses Cancellable and Subscription (Flowable only) |
Uses the Subscription class. |
TC39 Observable | No. | Yes. |
Performance | needs testing |
needs testing |