DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports Events Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

What's New in RxJS 6.0

We take a quick look into the RxJS library, the updates that come with its 6.0 version, and how to use it with the Angular framework.

Rohit Kawade user avatar by
Rohit Kawade
·
Jan. 07, 19 · Analysis
Like (1)
Save
Tweet
Share
7.77K Views

Join the DZone community and get the full member experience.

Join For Free

Hello everyone!

I have been working on an Angular 5 to Angular 7 migration. From Angular 5 onwards, RxJS 6.0 is used. I would like to share the RxJS changes with you.

rxjs-compat Is a Life Saver

If you are migrating a large project to RxJS 6.0, then you just need to install rxjs-compat. It will take care of your old code. You don't have to change anything. Everything will work fine.

What's Changed in RxJS 6.0?

The package structure, pipable operators, and some operators have been renamed. Let's look at these one-by-one.

1. The Package Structure

RxJS 6.0 has updated package structure to reduce the bundle size and easy imports. In the past we used to import as follows:

import { Observable, Subject } from ‘rxjs/Observable’

import rxjs/add/operator/map

import rxjs/add/operator/take

import rxjs/add/observable/fromEvent

import rxjs/add/observable/fromPromise

Now Observable, Subject, etc. are imported directly from ‘rxjs’ and operators such as map and take are imported from ‘rxjs/operators.’ The observable creation methods such as fromPromise and fromEvent are imported from ‘rxjs.’

import { Observable, Subject } from ‘rxjs’

import { map, take } from ‘rxjs/operators’

import { fromEvent, fromPromise } from ‘rxjs’

2. Pipable Operators

In the past we used to chain the operators as follows:

  • observable.map(…).throttle(…).subscribe(…).

Now we use the special pipe method on observable which takes the infinite number of arguments. These arguments are nothing but the operator functions.

observable.pipe(map(…), throttle(…)).subscribe(…).

Now due to this pipable operator, some operators have to be renamed as they were conflicting with the JavaScript keywords.

3. Renamed Operators

And that’s all! Hope it helps.

Operator (extension)

Published at DZone with permission of Rohit Kawade. See the original article here.

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • Stream Processing vs. Batch Processing: What to Know
  • Promises, Thenables, and Lazy-Evaluation: What, Why, How
  • Memory Debugging: A Deep Level of Insight
  • PostgreSQL: Bulk Loading Data With Node.js and Sequelize

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends: