RxJS Postal Service

Observables, delivered.

Follow the mail through your pipeline

Mail is posted in the mailbox, goes through the sorting centers, and is delivered to every subscribed house.

Mailbox0 posted
Mailbox
interval(1000)
waiting for mail…
#1transform
Sorting conveyor
map(mail => ({ ...mail, stamped: true }))
0 in 0 out
Last received
none yet
Last sent
none yet
Rose cottage
Rose cottage
subscribed 0 received
  • no mail yet

Equivalent code

// timed operators run on mailClock, e.g. interval(1000, mailClock): pause & speed control it
const mailbox$ = connectable(interval(1000).pipe(map(toMail)));
mailbox$.connect(); // posting starts now, listeners or not
const delivery$ = mailbox$.pipe(
  map(mail => ({ ...mail, stamped: true })),
);

delivery$.subscribe(house1); // Rose cottage