If you try the demo4 of my svg.rx.js project, with a multi-touch device (such as Nexus 7), you'll notice that the SVG circles are falling behind the fingers.
I'd like to skip coordinates if there are later ones, but it does not seem to be that simple. As far as I can tell, RxJS does not really buffer the values. It probably spins off my application's subscribe calls and once that happens, there's no way to cancel those - just let them run.
There's a very similar SO issue 11010602 but I would like to keep the code to the minimum, of course.
Can some more experienced RxJS fellow advice me on this? I'm currently using RxJS 4.0.7 and the relevant code is here. Thanks.
I've read about Backpressure with RxJS but none of the approaches worked. Using .sample
at the application side seems like the best bet (trying to get it working).
Edit:
Here's the way I'm trying to deal with it, using .sample
and a Subject
that would be triggered every time a coordinate has been processed - thus kind of synchronizing the stream to the drawing capabilities of the device (hopefully). Something with the types I get wrong, since it ends up not having .onNext
.
https://github.com/akauppi/svg.rx.js/blob/backpressure/demo/demo4.js