Skip to content

Latest commit

 

History

History
40 lines (25 loc) · 1.01 KB

asyncsubject.md

File metadata and controls

40 lines (25 loc) · 1.01 KB

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