Rx.Observable.prototype.doOnNext(onNext, [thisArg]), Rx.Observable.prototype.tapOnNext(onNext, [thisArg])

Invokes an action for each element of the observable sequence.

This method can be used for debugging, logging, etc. of query behavior by intercepting the message stream to run arbitrary actions for messages on the pipeline.


  1. onNext (Function): Function to invoke for each element in the observable sequence.
  2. [thisArg] (Any): Object to use as this when executing callback.


(Observable): The source sequence with the side-effecting behavior applied.


Using a function

Using a thisArg