To be clear, I'm hoping for factual information to be presented about RxJS and how it relates to JavaScript's evolution, not a matter of opinion on how good RxJS is, etc.
My question is: is RxJS ( https://github.com/Reactive-Extensions/RxJS ) somewhat of a forward-looking polyfill because of Object.observe, etc. not being standard among browsers yet, or does it fundamentally offer things beyond the scope of what native JS offers and beyond what JS standards seek to offer in the foreseeable future? (Granted, perhaps someday native JS may be capable of X, Y, Z that aren't currently on the radar; I'm not interested in guesses on those.) Perhaps it's a combo.
My motivation/interest in the question is in considering the investment of learning and implementing RxJS in applications, weighed against the timeline of native JS solutions being available, and/or whether there are other considerations to be mentioned that I have not touched on here.
Large, active community. One of the biggest strengths of the RxJS library is its sizeable and diverse community. Thanks to having such a responsive community, RxJS continues to improve and grow in popularity. Participants of the community help each other to handle the problems and questions on StackOverflow and Gitter.
The RxJS library is great for handling async tasks. It has a large collection of operators in filtering, error handling, conditional, creation, multicasting, and more. It is supported by JavaScript and TypeScript, and it works well with Angular.
RxJS provides a graceful API that makes it easy to describe a complex stream of data compact and precise. RxJS comes with a comprehensive kit of standard entities such as Subjects, Observables, and operators which undertakes all the hard work and makes it possible.
Learning RxJS and reactive programming is hard. There's the multitude of concepts, large API surface, and fundamental shift in mindset from an imperative to declarative style.
RxJS was birthed as a JavaScript port of Rx.NET. It is not a forward looking polyfill of Object.observe
.
RxJs is a library for working with asynchronous operations, with special emphasis on multi-valued operations. The library gives the developer a common "language" they can use to write functional code to manipulate asynchronous streams no matter the stream source. The same "language" works with any combination of UI events, timer events, object mutation observations, animation frames, ajax calls, websocket messages, webworker messages, promises, etc
Object.observe
is a mechanism to observe changes in an object. RxJS does not provide this functionality. But RxJS complements this functionality: As an object is changed over time, it can be thought of as a source of asynchronous object change notifications. It is fairly straight-forward to convert these observations into an RxJS source, (e.g. something like Rx.Observable.observeObject(someObject)
), which would then let you work with object changes as just another asynchronous RxJs stream with all of the vast array of tools RxJS makes available to you.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With