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 Observable disposable #150

Open
jasnell opened this issue Jun 10, 2024 · 0 comments
Open

Make Observable disposable #150

jasnell opened this issue Jun 10, 2024 · 0 comments
Labels
possible future enhancement An enhancement that doesn't block standardization or shipping

Comments

@jasnell
Copy link

jasnell commented Jun 10, 2024

It would be useful for the Observable class to support the upcoming Symbol.dispose or Symbol.asyncDispose mechanism (TC39 Explicit Resource Management proposal) such that when the Observable is disposed while still active, any outstanding subscriptions and closed and outstanding promises are rejected.

using obs1 = eventTarget.on('foo');
using obs2 = Observable.from(asyncIterable);

This is particularly helpful in cases where a block of code may wish to only temporarily attach itself to a particular event source (like an EventTarget that long outlives the Observable)

@domfarolino domfarolino added the possible future enhancement An enhancement that doesn't block standardization or shipping label Jun 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
possible future enhancement An enhancement that doesn't block standardization or shipping
Projects
None yet
Development

No branches or pull requests

2 participants