Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
remove RxJS code from the transports code
After doing a proof-of-concept looking at how some parts of the code looks like without RxJS (#916), this is a first functional proposal which looks good enough to me to be merged. It removes all RxJS code from the `transports` code in `src/transports`. As a reminder, the reasons for doing this are: 1. Observables are complicated and full of implicit behaviors (lazily running, sync or async, unsubscribing automatically after the last unsubscription etc.) which is difficult to reason about, especially for a newcomer. Things like exploiting schedulers through the `deferSubscriptions` util to work-around some subtle potential race-conditions, or merging Observables in a specific order for similar reasons, are ugly hacks that are difficult to explain to someone not familiar with that code. Even for us with multiple years of experience with it, we sometimes struggle with it. 2. Promises, event listeners - and direct callbacks in general - are generally much more explicit and most developpers (at least JS/TS devs) are familiar with them. 3. Call stacks are close to inexploitable when using RxJS. 4. Promises provide async/await syntax which can improve drastically the readability of our async-heavy code, which for the moment suffer from callback hells almost everywhere. However, I'm still not sure if this wish (getting rid of RxJS) is shared by other maintainers and/or contributors, so it is still only a proposal. Thoughts?
- Loading branch information