refactor(iron-remote-desktop): use PartialObserver instead of single callback for onSessionEvent#787
Conversation
…e callback for `onSessionEvent`
|
Before we move ahead with this change, I’d like to resurface an idea I mentioned in this PR comment: can we drop RxJS from Rationale:
In our context, is RxJS used mainly for error propagation? I’m all for better diagnostics, but unless RxJS solves a real pain point, zero dependencies feels like the bigger win. If you end up agreeing with me, do you think you could work on removing RxJS instead? Thanks! |
Hello. I think it should be possible to rewrite it to use
Not only error propagation, RxJS is also used to introduce I already made local changes to Devolutions Gateway Standalone, considering changes made by this PR. |
That's actually something I'm mentioning in my original comment:
It does not really seem necessary to me to use an Observable (~ AsyncIterator) because there is only a single value ever resolved at this place (this is accurately represented by Future/Promise). I think it's then possible to remove the code heavy with RxJS combinators (akin to iterator combinators, for operation on multiple values) to a more straightforward imperative code using the await keyword. But even if we really need something like Observable (listener/observer pattern), our usage appears so minor that the native EventTarget seems enough.
Sounds good to me! |
I've refactored the
onSessionEventmethod to usePartialObserverinstead of a single callback.This change gives the ability to pass
nextanderrorcallbacks instead of onlynextin places like this in Devolutions Gateway Standalone