LiveLoveApp logo

Complete Notification

Complete Notification

A complete notification signals that the Observable will not emit any more notifications. Note a complete notification does not emit a value.

Let's look at an example.

import { Observable } from 'rxjs';

const observable = new Observable((subscriber) => {
  subscriber.next(1);
  subscriber.next(2);
  subscriber.next(3);
  subscriber.complete();
  subscriber.next(4);
});

observable.subscribe({
  next: (value) => console.log(value),
  error: (e) => console.error(e),
  complete: () => console.log('complete'),
});

See the example on codesandbox

In the example above, we emit three next notifications and invoke the complete() method. Note the fourth next notification is not delivered because the Observable is complete.