Created
April 11, 2017 19:08
-
-
Save adrianfaciu/e01537925f272879fb656634dfce1860 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let myStream$ = Rx.Observable.from([1, 2, 3]); | |
myStream$.subscribe(value => console.log(value)); | |
let newStream$ = Rx.Observable.interval(1000); | |
newStream$.subscribe(value => console.log(value)); | |
// Use .take to stop it | |
let foo$ = Rx.Observable.range(5, 10); | |
foo$.subscribe(value => console.log(value)); | |
// emits one value, after the specified | |
let bar$ = Rx.Observable.timer(1000); | |
bar$.subscribe(value => console.log(value), _ => console.log('error'), _ => console.log('completed')); | |
myStream$.concat(foo$) | |
.subscribe(value => console.log(value)); | |
let mynewStream$ = Rx.Observable.from([1, 2, 3]).startWith(-1); | |
mynewStream$.subscribe(value => console.log(value)); | |
let obs$ = Rx.Observable.from([1, 2, 3]); | |
obs$.map(v => v + 3) | |
.do(v => console.log('do',v)) | |
.subscribe(value => console.log(value)) | |
let takeObs$ = Rx.Observable.interval(1000).take(10); | |
takeObs$.subscribe(value => console.log(value)); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment