Combining Obervables with Operators

Some operators will subscribe to other observables. takeUntil and skipUntil are like that.

const startingTime = Date.now();

const firstTimer$ = timer(2000);
const secondTimer$ = timer(7000);

const example$ = interval(1000).pipe(
  skipUntil(firstTimer$),
  takeUntil(secondTimer$),
);

example$.subscribe(() => console.log(Date.now() - startingTime));

// Logs: 2004, 3000, 4000, 5001, 6002

Exercise: Improving Our Counter

Alright, so we have a few new tricks up our sleeves.

Given the very simple UI in applications/counter-basic, can you wire up this simple counter.

It should be able to do the following: