-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Add start
method to Observers
#3061
Comments
And no, I won't be adding this to the 3-callbacks version upfront, it's sort of to cover an edge case, not sure it needs to have some ergonomic considerations. |
Why is the scenario a problem? |
@felixfbecker if a consumer wishes to cancel a synchronous firehose, they cannot do so easily with the basic observable impelmentation. They could "Rx" around it: const stop = new Subject();
// a hypothetical synchronous firehose of data.
const firehose = range(0, Number.POSITIVE_INFINITY);
firehose.takeUntil(stop);
.subscribe({
next(value) {
doSomeSideEffect(value);
if (checkSomeExternalState()) stop.next();
console.log(value);
}
}); ... but that's a lot of extra hoops to jump through. |
Regardless, I think we're going to move away from the |
Ah, got it. |
It feel like this could be easily solved by using
|
@martinsik this is meant to round out the type on its own and it's coming from the standards proposals in flight. |
And, of note, I was wrong.. even with abort signal, we'd need start. |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
The TC39 spec has a
start
method to prevent this scenario from being a problem:The solution was to add an optional
start
method to Observer:The text was updated successfully, but these errors were encountered: