Skip to content

Instantly share code, notes, and snippets.

@armanozak
Created May 3, 2021 08:51
Show Gist options
  • Save armanozak/43e32c396610aa87fd4db5d14fd4262b to your computer and use it in GitHub Desktop.
Save armanozak/43e32c396610aa87fd4db5d14fd4262b to your computer and use it in GitHub Desktop.
[What's New in RxJS 7] RxJS 6 toPromise #blog #rxjs
import { interval } from "rxjs";
import { map, take } from "rxjs/operators";
const count1To5$ = interval(1000).pipe(
take(5),
map(i => i + 1)
);
count1To5$.toPromise().then(console.log);
// (after ~5s) 5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment