-
Notifications
You must be signed in to change notification settings - Fork 7
Closed
Labels
codeImprovements to code quality or project architectureImprovements to code quality or project architecture
Milestone
Description
Since currently there is no Single class (like rxjava) in rxjs, it could be difficult for developers to figure out if the Observable only emits once. There are several discussion about this problem. E.g. ReactiveX/rxjs#5273.
We should use Promise instead of Observable to clearly indicate the behavior will only return ONE SINGLE value asynchronously. This would help developers to avoid lots of potential bugs when deciding which observable operator to use, such as forkJoin vs zip and toArray vs scan.
As a Promise can be easily transform into an Observable with defer function but it is an anti-pattern to transform an Observable into a Promise via toPromise function, we should:
- Prefer
PromisethanObservablefor return values. - Prefer
ObservablethanPromisefor parameters.
chernodub
Metadata
Metadata
Assignees
Labels
codeImprovements to code quality or project architectureImprovements to code quality or project architecture