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

Why not add the .addTeardown method to AbortSignal proper? #146

Closed
Jamesernator opened this issue May 11, 2024 · 1 comment
Closed

Why not add the .addTeardown method to AbortSignal proper? #146

Jamesernator opened this issue May 11, 2024 · 1 comment

Comments

@Jamesernator
Copy link

Jamesernator commented May 11, 2024

So on Subscriber we have .addTeardown which adds a convenient way to ensure teardown happens even if the subscriber is already closed. It's not clear to me why though this isn't just added to AbortSignal proper as it just calls the cleanup when subscriber.signal is aborted anyway.

The .addTeardown method would be equally useful in Promise (or callback) usage in basically the same pattern as in Observable so I don't really see a reason to restrict this method to being part of just Observable.

@domfarolino
Copy link
Collaborator

It seems like some version of it could have a place on AbortSignal. I recommend filing an issue on the DOM Standard. This is out-of-scope for this repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants