RxJS

By Rasoul Pashaie 

Jan 2020

Reactive Programming

A development model structured around asynchronous data streams

Normal Code

let a = 1;
let b = 2;
let c = a + b; // c = 3



a = 5; //What is c?

Reactive Code

let a = new BehaviorSubject(1);
let b = new BehaviorSubject(2);
let c = combineLatest(a, b).pipe(map( ([x, y]) => x + y));
c.subscribe(console.log);


b.next(20)
a.next(20)


setTimeout(()=>{
  a.next(5)
}, 2000)


setTimeout(()=>{
  b.next(5)
}, 4000)

ReactiveX

Title Text

Subtitle

RxJS

By pashaie

RxJS

  • 98