I am interested in using ReactiveX (rx.js) in an Aurelia application. I don’t know a lot about rx.js yet, but can definitely see that their Observable pattern can clean up some of my code.
My question is: To what extent does Aurelia work out-of-the-box with rx.js? In my immediate case, more specifically, does it bind to rx.js Observables?
Remember to dispose the subscriber this.subscriber1.dispose(). You can do the subscribe and dispose in attached()/detached() pair or bind()/unbind() pair.
Thanks huochunpeng, but how would this work when, for example, you want to repeat.for on an rx.js Observable which is semantically like an array but actually behaves quite differently from an array?
If you already have rx.js obserable in your app, that’s not what I was talking about.
Aurelia observes POJO (plain old javascript object), you don’t need any wrapper around your state.
I was suggesting it might be possible to remove rx.js from your app.
Yeah, I don’t want rx.js so I can observe changes to data, Aurelia is already great at that. Rather I want it for its ability to give me cleaner asynchronous code.
You cant bind to observables or promises directly, only to their results. So either you subscribe and store the values to the bindable manually or write a custom binding like the one linked from my previous reply
It would be interesting to understand what is thought when saying “integrates with Aurelia/RxJS”. If its up to the bindings, just use a binding behavior as provided here https://github.com/zewa666/aurelia-async-binding. If there’s anything else you’re looking for @kor it would be great to explain some use-cases
Maybe I was a bit unclear. I was thinking about the Angular framework where the rx.js is a core part of the framework. I was curious whether Aurelia is planning on taking the same route.
If I understand correctly, the support is currently added with a third-party plugin and may or may not be compatible with future versions of Aurelia?
There could be some experiment to make everything more observable awareness in the future, but the main commitment of Aurelia has always been plain and simple JS, as well as POJO (plain old JS object).