Questions tagged [rxjs5]

The 5th version of the reactive extensions for javascript.

This tag is for questions regarding the 5th version of the ReactiveX framework for the JavaScript language.

Basics

RxJS is a framework for Observables. Observables are similar to Promises, in that they represent data, that may not jet be available. The difference is, that Observables can get multiple results (they are said to observe multiple events). These events could be anything, like clicks on a button, or network requests.

RxJS

rxjs provides an API for working with Observables in JavaScript. It has many methods, that allow modifying Observables, similar to how map(), filter() and reduce() work on ES6 Arrays.

Links

Before asking an rxjs5 question here on StackOverflow, please make sure to read the official documentation.

1510 questions
0
votes
1 answer

Collecting the currently incomplete observables in a higher-order rxjs observable

For example, I have an observable that emits a 10-second timer every 5 seconds. I can use scan to create an observable that emits an array of all the inner observables emitted so far: tick = 5000 tock = 1000 timers = Observable.interval(tick).scan(…
Coquelicot
  • 8,775
  • 6
  • 33
  • 37
0
votes
2 answers

How to resolve http requests in sequence using Rxjs

I have a js object like this var routes = [ {lat: 12.44, lng: 74.50}, {lat: 12.54, lng: 74.60}, {lat: 12.64, lng: 74.70}, ... ]; I want to calculate distance between 2 points from the routes array to create a new array with lat,lng…
FarazShuja
  • 2,287
  • 2
  • 23
  • 34
0
votes
1 answer

Drag and Drop implemented using Rxjs not working

Trying to create a drag n drop implementation from an Rxjs course example, but its not working correctly. Some time the box is dragged back to original position some times it just get stuck. Here is the…
coure2011
  • 40,286
  • 83
  • 216
  • 349
0
votes
0 answers

How correctly load settings to my angular2 app

I'm trying to do the initialization settings, but it seems that I am doing something wrong main.service.provider.ts import {Injectable} from "@angular/core"; import {Http, Response} from '@angular/http'; import {Observable} from…
slowkazak
  • 95
  • 1
  • 4
0
votes
1 answer

Converting RxJS v4 code to v5, processing a queue with a "pull"

---abcde-----f-------gh-----i----> //Events I have a "work queue" that I want to observe/subscribe to. This is an array of command objects to process. New items of work typically arrive in bursts and they need to be processed serially (in the…
Mark Eric
  • 753
  • 1
  • 7
  • 14
0
votes
1 answer

Wait for a stream before invoking another stream

How do I wait for one stream (say, StreamA) to return non-null value and then invoke StreamB subscribe function. I'm not particularly interested in StreamA's value. In turn, I am trying to get StreamB's value which might have been updated before the…
ankitjain11
  • 253
  • 2
  • 16
0
votes
1 answer

Does Observables in RxJavaScript imply asynchronous execution

I'm mostly a newbie to JavaScript and RxJs so my question may not even make sense but I'm trying to understand if Observables in RxJavaScript ought to be used in conjunction with an async library or does it handle it internally?
Ranjit Iyer
  • 857
  • 1
  • 11
  • 20
0
votes
2 answers

How to get events from one stream which happened after the last event from other stream

There are two streams, which never completes: --a---b-c-d---e--f----> -----1-------2------3--> I want to get events from the first stream which happened after the last event from the second stream. At the beginning it looks like this: --a-> …
daslashi
  • 357
  • 1
  • 3
  • 13
0
votes
1 answer

Angular 2 chain http requests with iterable array and merge resutls

New to angular and confused with the flatMap function. export interface IProduct { productId: number; productName: string; versionUrl: string; versionObj: any; } product.service.ts: First HTTP request returns array of IProduct…
0
votes
1 answer

Two-way binding between an angular 2 component and service using Observable

I've been trying to make a simple relation between an angular 2 component and service, but I can't figure it out how to do so using Observable. My component HeroViewerComponent subscribes to the router parameter id and passes it to a service…
user2112300
  • 244
  • 3
  • 9
0
votes
0 answers

*ngFor | async doesn't work

There is a input text that for each change, he get from my service the search results. My serivce returns : Observable that contain all the results. It will return multiple persons. tamplate.html: ...
Stav Alfi
  • 13,139
  • 23
  • 99
  • 171
0
votes
1 answer

Observable function to returned a chunked array

I have a function that returns something like Observable<[number, Array]>. Is it possible to write some function that returns Observable<[number, Array] using some Observable functions, given a function chunk (chunks the…
Lars Nielsen
  • 365
  • 1
  • 2
  • 14
0
votes
2 answers

Basic questions about Rxjs

Im developing a small app with angular2 and I installed Rxjs 5. In every tutorial there is a diffrent way to import the Rxjs libary. The code to import in angular2 web is not working; I mean that Websotrm doesn't recognize Observable or any of its…
Stav Alfi
  • 13,139
  • 23
  • 99
  • 171
0
votes
1 answer

Rxjs: The scan operator

I have been reading this code if I will replace scan with map I get can not get property "getTime" of undefined, why is it happening I assume that both operator takes an item emits from observable and apply some function on it this.clock =…
blackHawk
  • 6,047
  • 13
  • 57
  • 100
0
votes
2 answers

Why am I only getting a few functions when I'm importing rxjs/Rx

I am importing like this: import { Observable } from 'rxjs' ; or import { Observable } from 'rxjs/Rx' ; And declared a property like this ob : Observable; When I write this.ob.fromarray() in my constructor I'm only getting IntelliSense for…
blackHawk
  • 6,047
  • 13
  • 57
  • 100