rxjs - Rx.Observable.repeat (indefinitely) with zip causes the browser to stop responding -


For repeating example, using the value like '100', the response to the following code is stopped It does the problem, but in my case I do not have a specific value for it. Would you please provide a solution:

  var observer = Rx.Observer.create (function (x) {console.log (x)}}, function (error) {console .log ('error:' + error);}, function () {console.log ('full');}); Var repeat = Rx.Observable.repeat (10, empty); // Repeat indefinitely = Rx Obsequable interval (1000); var zip = Rx.Observable.zip (Repeat, Interval, Work (Rep, Difference) {return Rep + Intra;}); zip.subscribe;    

The browser freezes because .repeat just generate < Code> 10 indefinitely.

Since RX is push-based, there is no way to know that when zip requires any other item. Instead, we only make the new value available to zip , as if they become available. Still (class-method?) repeats says "Hey, I have new items, these are always right now" and the Zip-Over control flow will never go back. This means that the pin is not actually worth seeing intervals , so the zip bus starts buffering indefinitely.

If you are coming from a functional background, then it will pinpoint a "10" "infinite" list with a limited list of anything that is absolutely correct, assuming its infinite catalog Is lazy In this case, our "list" has its own mind, and certainly is not lazy.

I would be happy to suggest solutions, but it seems that the example is fictional. What are you really trying to do?

Comments

Popular posts from this blog

Java - Error: no suitable method found for add(int, java.lang.String) -

java - JPA TypedQuery: Parameter value element did not match expected type -

c++ - static template member variable has internal linkage but is not defined -