-
Notifications
You must be signed in to change notification settings - Fork 75
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
Introduce AnonymousSubject #54
base: master
Are you sure you want to change the base?
Conversation
Observable.create's one-argument version was not properly documented, and the return type is not described either. But to document that it returns a Subscription we should first make it do so.
RxLua only has a zero-version create() function for Subject, corresponding to the constructor of RxJS for example. However, RxJS has a two-argument create() function, returning a subject that simply juxtaposes an observable and an observer into a single object. Quite confusingly, the object returned by create() is not a Subject, but an instance of a different class AnonymousSubject. Introduce AnonymousSubject as a completely separate implementation to avoid overloading Subject.create.
Hi, could you please take a look at this? |
Personally I'm wondering what's the use case for that? I know the AnonymousSubject class but I've never seen it actually used anywhere in the real code outside of the RxJS internals. Can you provide some examples when is it useful to have something like that? |
You can use On the Observer side, the |
Thanks for the explanation. I'm maintaining a fork of this library which I called Lua-ReactiveX and I've also included I'm considering however to rename it to something else like ProxySubject and leave it private behind the scenes, and then an actual public implementation of |
Not sure when but yeah, I can contribute with a pull request. |
RxLua only has a zero-version create() function for Subject, corresponding to the constructor of RxJS for example. However, RxJS and other ReactiveX implementations also have a two-argument create() function, returning a subject that simply juxtaposes an observable and an observer into a single object. Quite confusingly, the object returned by create() is not a Subject, but an instance of a different class
AnonymousSubject
. This pull request introducesAnonymousSubject
as a completely separate implementation to avoid overloading Subject.create.