Posts

Showing posts from July, 2020

RxJS

Image
 RxJS: Reactive Extensions for JavaScript We need RxJS to handle asynchronous data easily  Asynchronous data: Data from HTTP response, data from a port, user click events, timer etc Observer and Observable Observer: RxJS object that emits data stream Observable: Entity that  is listening to the stream In order to initiate communication between data and listener in RxJS scope, first they need to be converted to "observer" and "observable" Observer subscribes to the observable to listen to the data stream Use of "subscribe:" Used to listen to the data stream OPERATORS Operators are small pieces of code that can be applied as pre-processing logic before data comes to the listener Summary of common operators: map:   used to manipulate responses from the API filter: used to filter values based on condition. Same as ES6 filter but this is for Observable merge:  This operator combines a number of observables streams and concurrently emits all values from ever...