Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for onAbort argument on XHR.perform
`XHR.perform` method creates a `K.stream` and emits value by binding to some `XMLHttpRequest` events. That way you can be notified about this request state changes through observable events. > As you might already guess *activation* and *deactivation* propagates > up the observables chain. For instance if one create a long chain like > `Kefir.fromEvents(...).map(...).filter(...).take(...)`, the whole chain > will be *inactive* until first subscriber is added, and then it will > *activate* up to `.fromEvents`. Same for *deactivation*. *Extracted from [Kefir docs]. While the request is correctly aborted when the request observable is unsubscribed, the abort event is not propagated to the observable chain given they have already been unsubscribed. I'm not familiar with any solution within Kefir realm that would allow us to be notified of such changes, and while one could probably create an abstraction on top of `XHR.perform` to run a custom code on abortion (unsubscription), it seems weird not to provide a solution for this problem. The proposal is to support a custom `onAbort` argument when calling `XHR.perform` that will be executed when the request is deactivated and subsequently aborted. [Kefir docs]: https://kefirjs.github.io/kefir/#active-state
- Loading branch information