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.
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.
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 toAbortSignal
proper as it just calls the cleanup whensubscriber.signal
is aborted anyway.The
.addTeardown
method would be equally useful in Promise (or callback) usage in basically the same pattern as inObservable
so I don't really see a reason to restrict this method to being part of justObservable
.