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

Non expected behavior in tutorial example #1975

Closed
mark-meyer opened this issue Sep 25, 2016 · 2 comments · Fixed by #1996
Closed

Non expected behavior in tutorial example #1975

mark-meyer opened this issue Sep 25, 2016 · 2 comments · Fixed by #1996

Comments

@mark-meyer
Copy link

mark-meyer commented Sep 25, 2016

The first example in rxjs/doc/tutorial/basics.md - Creating observables - produces no output.

var myObservable = Rx.Subject.create();  
myObservable.subscribe(value => console.log(value));  
myObservable.next('foo');

Is this a typo? Show it be var myObservable = new Rx.Subject ?

@benlesh
Copy link
Member

benlesh commented Oct 3, 2016

Is this a typo? Show it be var myObservable = new Rx.Subject

Yes. this is a typo. Subject.create does something completely different than new Subject(). It's made for combining an observer and an observable into a subject, not simply newing up a subject.

This is probably a point for debate for future versions of the library (the current behavior mirrors what's existed in prior versions), but at the very least, this is a bug in the docs.

@lock
Copy link

lock bot commented Jun 6, 2018

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Jun 6, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants