Rx.Observable.prototype.doOnCompleted(onCompleted, [thisArg]), Rx.Observable.prototype.tapOnCompleted(onCompleted, [thisArg])

doOnCompleted

Invokes an action upon graceful termination 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. oncompleted (Function): Function to invoke upon graceful termination of 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