-
Notifications
You must be signed in to change notification settings - Fork 90
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
What operators *require* a synchronous error
or complete
?
#131
Comments
I'm aware that |
'Require' is a tough criteria. From experience using RxJs's implementation of Observables in user interfaces which run on devices with limited resources, maximising synchronous calls is essential to achieving performance. An asynchronous call can't be inlined. One example where an asynchronous complete would delay getting a value to an observer: const lastValue = observable =>
new Observable(observer => {
const cache = [];
return observable.subscribe(
value => cache[0] = value,
err => observer.error(err),
() => {
if (cache.length === 1) {
observer.next(cache[0]);
}
observer.complete();
}
);
}); |
Observables must be able to synchronously dispatch complete and error notifications. See here for a comprehensive explanation. https://docs.google.com/document/d/1Zo-ls61hNviKl-hfLSoR3NeGoIA-Z0cBvQRof5YEzVw The rationale document above includes several operators which need the ability to dispatch synchronously. |
@jhusain Thanks! |
Besides
onErrorResumeNext
, what operators require a synchronouserror
orcomplete
?(Stemmed from @zenparsing's response to a quick strawman of mine.)
/cc @Blesh @jhusain
The text was updated successfully, but these errors were encountered: