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

Make AnonymousSubject public #2002

Closed
bisubus opened this issue Oct 4, 2016 · 5 comments · Fixed by #2003
Closed

Make AnonymousSubject public #2002

bisubus opened this issue Oct 4, 2016 · 5 comments · Fixed by #2003
Assignees

Comments

@bisubus
Copy link

bisubus commented Oct 4, 2016

This is a duplicate of closed Reactive-Extensions/RxJS#227 issue. The mentioned issue has a good point that it is a nice base class for creating subject subclasses.

In RxJS 5, AnonymousSubject isn't exported as Rx.AnonymousSubject, again.

@kwonoj
Copy link
Member

kwonoj commented Oct 4, 2016

I don't see strong reason to prevent export it in index, but in current package you can still access it such as import {AnonymousSubject} from 'rxjs/Subject'.

@benlesh
Copy link
Member

benlesh commented Oct 4, 2016

What's the use case for needing it externally? It's basically just Subject.create. The only negative I could see is if we move it to another module, it could end up creating more module code in the output bundle.

@bisubus
Copy link
Author

bisubus commented Oct 4, 2016

Currently I'm using it like

class CustomSubject<T> extends AnonymousSubject<T> {

    constructor(...) {
        ...
        let customSubject = new SomeSubject(...);
        let customObservable = customSubject.asObservable().do(...)...;

        super(customSubject, customObservable);
    }

    next(value: T): void {
        ...
        somePromise.then(() => super.next(value));
    }
}

It does the job. There's nothing wrong with importing it from rxjs/Subject directly but I'm concerned about using a private class from package internals.

@benlesh
Copy link
Member

benlesh commented Oct 4, 2016

Hmmm... that's a strange use case. But I think that extending AnonymousSubject seems like a valid use case on it's own.

Seems legit.

@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.

3 participants