AsyncSubject

Emits its last value on completion

Ultimate RxJS

Examples

Example 1: simple AsyncSubject

( Stackblitz )

// RxJS v6+
import { AsyncSubject } from 'rxjs';
const sub = new AsyncSubject();
sub.subscribe(console.log);
sub.next(123); //nothing logged
sub.subscribe(console.log);
sub.next(456); //nothing logged
sub.complete(); //456, 456 logged by both subscribers

Additional Resources

📁 Source Code: https://github.com/ReactiveX/rxjs/blob/master/src/internal/AsyncSubject.ts