Difference between new Observable(...) and Rx.Observable.create(...)?
There is no difference. Observable.create
calls new Observable
.
As the manual says,
Observables are created using Rx.Observable.create or a creation operator
<...>
Rx.Observable.create is an alias for the Observable constructor
Observable.create
is conventionally used, probably because it reads better in chains and conforms with other Observable
static methods that create observables, too.
The difference may appear in child classes. For example, Subject.create
is equal to AnonymousSubject.create
and not equal to new Subject
. Usually Subject.create
is the one that provides desirable behavour, while new Subject
is more low-level. This confirms the point about the convention.
On the other hand, some classes (notably BehaviorSubject
) are supposed to be used with new
because create
signature doesn't allow to provide the desired behaviour to them.
The two are interchangeable, but the inline documentations says that Observable.create
is deprecated (future proof link here).