reactive.how 2.0-alpha Menu

How ❚ max works under the hood in RxJS

This is how a ❚ max operator would operate with an input stream:

  • When the input stream completes, the output stream:
    • emits the largest value emitted on the input stream
    • and immediately completes

Some reactive stream libraries (eg. RxJS) provide this ❚ max operator, while others don’t. How would you code max yourself?

Watch the solution below.

Comparer function

In RxJS, ❚ min and ❚ max accept on optional comparer function as an argument.

For example:

See also


count

💌 I create something new each week!
Learn Reactive Programming and stay tuned.

Occasional updates, plus:

Cédric Soulas - Freelance Developer Advocate. Learn more.

Follow 👨‍💻 Hire me

News

@CedricSoulas