observable
observable copied to clipboard
Why not add the .addTeardown method to AbortSignal proper?
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.