Skip to content

Instantly share code, notes, and snippets.

@rafagsiqueira
Created January 16, 2021 14:55
Show Gist options
  • Save rafagsiqueira/52d82684a057ae3f8f0ef2bb8dc98f1e to your computer and use it in GitHub Desktop.
Save rafagsiqueira/52d82684a057ae3f8f0ef2bb8dc98f1e to your computer and use it in GitHub Desktop.
Asynchronous methods with multiple promises and RxJS
getUsers$ = (): Observable<any> => {
if (someCondition) {
return from(someAsyncOperation())
}
else {
return from(someOtherAsyncOperation())
}
}
getUsers2$ = (): Observable<any> => someCondition ? from(someAsyncOperation()) : from(someOtherAsyncOperation())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment