W3cubDocs

/ReactiveX

IgnoreElements

do not emit any items from an Observable but mirror its termination notification
IgnoreElements

The IgnoreElements operator suppresses all of the items emitted by the source Observable, but allows its termination notification (either onError or onCompleted) to pass through unchanged.

If you do not care about the items being emitted by an Observable, but you do want to be notified when it completes or when it terminates with an error, you can apply the ignoreElements operator to the Observable, which will ensure that it will never call its observers’ onNext handlers.

See Also

Language-Specific Information

ignoreElements

RxGroovy implements this operator as ignoreElements.

ignoreElements does not by default operate on any particular Scheduler.

ignoreElements

RxJava implements this operator as ignoreElements.

ignoreElements does not by default operate on any particular Scheduler.

ignoreElements

RxJS implements this operator as ignoreElements.

Sample Code

var source = Rx.Observable.range(0, 10)
    .ignoreElements();

var subscription = source.subscribe(
    function (x) { console.log('Next: ' + x); },
    function (err) { console.log('Error: ' + err); },
    function () { console.log('Completed'); });
Completed

ignoreElements is found in each of the following distributions:

  • rx.js
  • rx.all.js
  • rx.all.compat.js
  • rx.compat.js
  • rx.lite.js
  • rx.lite.compat.js

© ReactiveX contributors
Licensed under the Apache License 2.0.
http://reactivex.io/documentation/operators/ignoreelements.html