-
Notifications
You must be signed in to change notification settings - Fork 16
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
takeUntil - accept abort signals #145
Comments
Can you just do |
The signal can already be aborted, in which case the abort event will never fire again. |
I guess AbortSignal could maybe override the |
This does feel like kind've a can of worms as it means But also more generally there are plenty of events that could be argued should have the same behaviour, for example If we did go this route, I think it would be better to have this ability across the board for supported events, e.g.: signal.on("abort", { initial: true });
taskController.on("prioritychange", { initial: true });
// Also available for classic event listeners too
signal.addEventListener("abort", () => {}, { initial: true }); Also there is another general issue with Accepting |
Yeah, this is one of the things that
If Related to #146 |
So I'm trying to figure out what the meat of this issue is. Is it just about
If that's what this issue is about, then I guess I'd point to #146 (comment) and we can discuss this elsewhere. But then reading:
I'm not sure I understand what to make of this. Specifically, I'm not sure what "like all other builtins do" means here, can you clarify @Jamesernator? Is the proposal here to allow |
The meat of the issue is that it would be convenient to pass abort signals to
That is merely a bonus advantage.
Yes.
I don't know that there's any obvious use cases in the other methods, though I suppose if internally |
Yeah I guess we'd need to figure out if just |
Hmm, I wonder if we should introduce a static method like I'm not sure we want to go off on our own and introduce the precedent (only in the Observable spec) that AbortSignals are sometimes treated specially, and can help trigger side effects if they are already aborted yet still passed in, without going through the DOM Standard / changes to AbortSignal itself. But static APIs like |
It would be nice if addition to the existing overloads we had an overload for
.takeUntil
that accepted anAbortSignal
. An example of usage:The main difference compared to
.forEach(cb, { signal })
is that intermediate work wouldn't be interrupted (i.e. the cancellation happens between items, whereas if there were say a.flatMap
then that inner observable would be interrupted which isn't always desirable).The text was updated successfully, but these errors were encountered: