liveBook · Manning

RxJS

As explained in Functional Programming in JavaScript

A JavaScript library for composing asynchronous and event-based programs using observable sequences.

RxJS provides one way to handle asynchronous and event-based data. It turns values from user input, web services, files, databases, notifications, and collections into observable streams: ordered events over time that you read by subscribing. section 8.4

Transforming a stream

An observable can be filtered and mapped before subscription. The sequence 1, 2, 3, 4, 5 becomes 1, 9, 25 by keeping odd values and squaring them. section 8.4

   Rx.Observable.of(1,2,3,4,5)
     .filter(x => x%2 !== 0)     
     .map(x => x * x)                                            #1
     .subscribe(x => console.log(`Next: ${x}`)); 
   //-> Next: 1
        Next: 9
        Next: 25

See a compact RxJS pipeline that filters values, maps them to squares, and prints each emitted result. section 8.4

Handling browser input

RxJS can subscribe to a student SSN field’s change events, extract the entered value, clean it, check its length, and report whether it is valid. section 8.4

How Functional Programming in JavaScript covers it

How deep it goes
Defines observables and demonstrates subscription, filtering, mapping, event conversion, promises, and stream flattening without covering library internals.
Examples
Uses numeric ranges, generated squares, SSN input events, and student data loaded from a promise.
What it assumes
Assumes basic JavaScript and asynchronous-event familiarity while introducing observables as a unifying concept.
What you can do after
Apply RxJS to compose, transform, and subscribe to asynchronous values and browser events.
How it connects
Connects observable streams with reactive programming, functional programming, promises, asynchronous events, and event-based programming.

Also explained in

Compare how 2 books explain RxJS →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Functional Programming in JavaScript. The section links point to the parts of the book it draws on.