RxJS Subject pass value before subscribing
const rxjs = require('rxjs');
const { Subject } = rxjs
const subject = new Subject();
// Subscriber 1
subject.subscribe({
next: (v) => console.log(`observerA: ${v}`)
});
subject.next(1);
// Subscriber 2
subject.subscribe({
next: (v) => console.log(`observerB: ${v}`)
});
subject.next(2);
no comments