rxjsreactive-programmingreactivex

using Events and Streams without RxJS


I'm not sure why one should use RxJS(ReactiveX).

There is already a good EventEmitter <-> Listener in Javascript eco.

You can emit() and addEventListener() for that Subject(Observable) which seems same as using RxJS.

Also there are many "stream" APIs that can be used instead of RxJS.

For example there is fs.createReadStream() method that has 'data' event.

So when dealing with file inputs you don't need RxJS.

Can anyone tell me in which scenario RxJS is better or different over EventEmitter?


Solution

  • RxJs has a massive amount of utility functions that combine stream, filter streams, manipulate data in the streams, cache, replay, throttle and lots more. If you are programming reactively it gives you a massive amount of power to create an observable of the data you need.