Skip to content

Instantly share code, notes, and snippets.

@helderjnpinto
Forked from MichalZalecki/index.js
Created August 17, 2017 14:51
Show Gist options
  • Save helderjnpinto/f4ace9e091fa7fbbe0c4308e783a2f1a to your computer and use it in GitHub Desktop.
Save helderjnpinto/f4ace9e091fa7fbbe0c4308e783a2f1a to your computer and use it in GitHub Desktop.
How to import RxJS 5
// Import all
import Rx from "rxjs/Rx";
Rx.Observable
.interval(200)
.take(9)
.map(x => x + "!!!")
.bufferCount(2)
.subscribe(::console.log);
// Add operators (my favourite)
import {Observable} from "rxjs/Observable";
import "rxjs/add/observable/interval";
import "rxjs/add/operator/take";
import "rxjs/add/operator/map";
import "rxjs/add/operator/bufferCount"
Observable
.interval(200)
.take(9)
.map(x => x + "!!!")
.bufferCount(2)
.subscribe(::console.log);
// JavaScript ES7 Function Bind Syntax
import {Observable} from "rxjs/Observable";
import "rxjs/add/observable/interval";
import {take} from "rxjs/operator/take";
import {map} from "rxjs/operator/map";
import {bufferCount} from "rxjs/operator/bufferCount"
Observable
.interval(200)
::take(9)
::map(x => x + "!!!")
::bufferCount(2)
.subscribe(::console.log);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment