-
Notifications
You must be signed in to change notification settings - Fork 13
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
DISCUSSION 2: ObserverSpy API - passing OnComplete
callback in the constructor?
#14
Comments
I want to add a point to the downsides: But then again, it's getting a bit complex. Maybe it's worth it, and I'm just missing some other advantages? |
I'm not sure what's the use case for this hook. In addition to that, if you add the |
Solution: I wouldn't implement this feature. 😁 Alternative: I would replace by it by Reason: I think that tests should never use callbacks because:
If we keep it, I would expect it to be an I might miss some edge case where a callback is easier to read... but I can't figure it out. |
Thanks @katharinakoal @NetanelBasal @yjaaidi for your feedback! Younes - yeah, I agree with returning a promise The original One use case I can think of is maybe older code that doesn't support async-await or promises, but I don't think it's that common, so we might just remove it in the future... |
Hi, agree with @yjaaidi about using Promises, it's always better! Maybe we can deprecate the |
Thanks for the feedback @edbzn ! I thought about maybe another potential reason - whether using promises has any performance implications (microtasks queue wise) So maybe callbacks, for sync Observables, could have slightly better performance? (not sure, just an unchecked thought) and that could be a reason to keep them... Any thoughts/insights about that? |
Interesting point 🤔 Otherwise, I'd focus more on simplicity and reducing the library's surface than the impact of an almost superfluous teeny-weeny micro tasky 😊 |
Finally I had some time to get back to these issues 😅 I'm closing this issue as it seems like the majority thinks it's better to stay with async await (promises). Thanks everyone for participating! BTW, You can view the latest release with @ThomasBurleson 's improvements here - |
CONTEXT:
Following #12 (by the amazing @ThomasBurleson) we had a discussion and realized this PR could be separated into several PRs, and before that we need to discuss them.
This one is about: the possible changes to the ObserverSpy API to make it more "getters" focused.
The suggested API changes to
ObserverSpy
-The upsides (IMO) -
The downsides (IMO) -
Plus, if you keep the
onComplete
method, you then have another discussion to have - "what happens when you define both callbacks? do they co-exist or not?"I'd love to hear your thoughts / corrections @ThomasBurleson @katharinakoal @edbzn @burkybang @yjaaidi (and whoever is interested), before we decide whether to break it into its own PR.
SO... WHAT DO YOU THINK?
The text was updated successfully, but these errors were encountered: