Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(Observable): deprecate create method (#3982) #4080

Merged
merged 1 commit into from
Nov 27, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/internal/Observable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ export class Observable<T> implements Subscribable<T> {
* @param {Function} subscribe? the subscriber function to be passed to the Observable constructor
* @return {Observable} a new cold observable
* @nocollapse
* @deprecated use new Observable() instead
*/
static create: Function = <T>(subscribe?: (subscriber: Subscriber<T>) => TeardownLogic) => {
return new Observable<T>(subscribe);
Expand Down
4 changes: 3 additions & 1 deletion src/internal/Subject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@ export class Subject<T> extends Observable<T> implements SubscriptionLike {
super();
}

/**@nocollapse */
/**@nocollapse
* @deprecated use new Subject() instead
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm. I'm not sure about this deprecation message, as this create method does things that cannot be done with the Subject constructor alone. Your thoughts, @benlesh ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was not very sure about this one too because the constructor signature is different. Observable one is more straight forward.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's fine. The only thing that create did that new Observable couldn't was allow apply and call, which people can get from a simple factory function.

*/
static create: Function = <T>(destination: Observer<T>, source: Observable<T>): AnonymousSubject<T> => {
return new AnonymousSubject<T>(destination, source);
}
Expand Down