Created
June 22, 2018 14:44
-
-
Save ajcrites/c005359dab9a6a63510587e30adf781c to your computer and use it in GitHub Desktop.
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 { of } from 'rxjs'; | |
import { map, mergeMap } from 'rxjs/operators'; | |
of(1).pipe( | |
map(async () => await Promise.resolve('hello?')), | |
// mergeMap incuded here because of how it's written in the original code. | |
// It has no effect on the async value that's passed in. | |
mergeMap(customerId => { | |
// Promise { <pending> } | |
console.log(customerId); | |
return []; | |
}), | |
).subscribe(); | |
of(1).pipe( | |
map(() => Promise.resolve('hello?')), | |
mergeMap(customerId => { | |
// Promise { 'hello?' } | |
console.log(customerId); | |
return []; | |
}), | |
).subscribe(); | |
// 'hello!' | |
of(1).pipe(mergeMap(() => Promise.resolve('hello!'))).subscribe(console.log); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment