Created
May 3, 2021 08:51
-
-
Save armanozak/43e32c396610aa87fd4db5d14fd4262b to your computer and use it in GitHub Desktop.
[What's New in RxJS 7] RxJS 6 toPromise #blog #rxjs
This file contains hidden or 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
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