Operator type

Operator Optimization

Static|Observable methods / Observable factory
VS
Instance methods / Observable instance methods

Core/Common/Main Operator

Map Operator


            Rx.Observable.fromEvent(document, 'click')
            .map(ev => ev.clientX)
        
It passes each source value through a transformation function to get corresponding output values

Filter Operator


            Rx.Observable.timer(0, 1000)
            .filter(x => x % 2 === 0)
        
It only emits a value from the source if it passes a criterion function

Reduce Operator


                Rx.Observable.timer(0, 1000)
                .take(6)
              .reduce((acc, cur) => acc += cur, 0)
            
Combines together all values emitted on the source, using an accumulator function that knows how to join a new source value into the accumulation from the past

Scan Operators

It's like reduce, but emits the current accumulation whenever the source emits a value

Exercice