Questions tagged [rxjs]

A JavaScript library that uses observables to work with reactive programming that deals with asynchronous data calls, callbacks and event-based programs.

Resources

Related tags

20563 questions
6
votes
1 answer

Combine two RxJS streams (based on synchrony)

I have two RxJS subjects, say a and b that I need to combine somehow. someComboOfAandB.subscribe({aVal, bVal} => console.log("value:", aVal, bVal)); I want to combine them such that if a and b are updated synchronously, the values are delivered…
JKillian
  • 18,061
  • 8
  • 41
  • 74
6
votes
4 answers

combineAll does not emit on empty array

JSBIN Sample I have a changeable set of child components (POJO object) that each have its own state stream. Each time a user triggers addChild/removeChild/clearChildren, a new set of children state streams is emitted with #switchMap. So far so good!…
Marcus Rådell
  • 622
  • 7
  • 12
6
votes
5 answers

Is it possible to add Teardown logic to an already existing Observable?

For instance, I'm currently calling unsubscribe from an Observable that is returned from Angular 2's HTTP module. But I need to have some custom logic surrounding it. Is it possible to add custom teardown logic to an already existing Observable,…
Nick Snick
  • 911
  • 1
  • 9
  • 16
6
votes
5 answers

How to make an observer to return as observable?

I'm new to rxjs and would like some help on how to solve this. I want to pass an Observer to onAuthStateChanged(), which takes an observer object. The observer would do some work and emit a boolean value such that the boolean value can be returned…
Sam
  • 1,288
  • 1
  • 13
  • 22
6
votes
5 answers

What is the "reactive" way to read file line-by-line

I'm learning reactive programming using RxJS and encounter a case when I need to read a file line-by-line. Actually I solved it using a solution likes: https://gist.github.com/yvele/447555b1c5060952a279 It works, but I need to use some normal JS…
Yoshi
  • 563
  • 1
  • 6
  • 17
6
votes
1 answer

Angular 2 rxjs timeout callback

I want to provide feedback to the user if a timeout event on a HTTP call happens. I tried this: return this._http .post(apiUrl + 'Search/Everything', params, {withCredentials: true, headers: this.headers}) …
Glenn Utter
  • 2,313
  • 7
  • 32
  • 44
6
votes
1 answer

Rxjs - resubscribe to unsubscribed Observable

I'm using a Service to "ping" my server every 2.5s, returning the response time from my server. Therefore I am using observables. I am also using angular 2 and typescript. I now want to stop the service (unsubscribe) on button click. This works…
Faigjaz
  • 818
  • 3
  • 15
  • 30
6
votes
1 answer

Angular2, systemjs, Failed to use Rx.umd.js

With the recent version of Angular RC4, Rxjs is available with node_modules or npmcdn.com directory. Successful plunker but not using .umd.js http://plnkr.co/edit/B33LOW?f=systemjs.config.js&p=preview This is the Network tab screenshot of…
allenhwkim
  • 27,270
  • 18
  • 89
  • 122
6
votes
1 answer

@ngrx/store subscription to part of a store and avoid detecting changes to other parts

Background One of the reducers in my store deals with things that are selected within the app. The interface for this store (let's called it app) could look like this: interface IApp { selectedProject: IProject; selectedPart: IPart; } So I…
freethebees
  • 957
  • 10
  • 24
6
votes
2 answers

How to implement AuthGuard waiting a connection in Angular 2

I'm creating a web application using Angular 2 (RC.3) with @angular/router alpha.8. This new router provides "Guard", it helps our to implement to handle authorization redirect. An official documents are wrote how to create and use Guard, but its…
Yohsuke Inoda
  • 521
  • 1
  • 6
  • 20
6
votes
2 answers

What's the use case of Notification in RxJS?

I'm somewhat familiar with basic RxJS concepts like Observables, Observers and Subjects but RxJS Notifications concept is completely new to me. What is it for? When should I use it?
GMX
  • 107
  • 1
  • 10
6
votes
2 answers

How to test observable containing a debounce operator?

How does one write a Jasmine test to test an observable with the debounce operator? I've followed this blog post and understand the principles of how it should be tested, but it just doesn't seem to work. Below is the factory that I am using to…
Pete
  • 3,246
  • 4
  • 24
  • 43
6
votes
4 answers

how to pass object to rxjs subscribe() callback function?

I am developing a Ionic2 App, using the cordova-plugin-network-information, I am subscribing to the connect and disconnect events from my app.ts and want to be able to pass a reference to my NavController and a Loading component into the subscribe()…
Will de la Vega
  • 536
  • 1
  • 5
  • 17
6
votes
1 answer

rxjs observable.of(object) returns {"_isScalar": "", "value": {}, "scheduler": "" } instead of value

I am fairly new to rxjs. I tried to create a function that runs a angular 2 http request like that: syncFromApi$() { // create Headers ... let ob$ = this.http.post( CONFIG_APP.apiEndpoint + '/sync/app', '', { headers: headers } …
divramod
  • 1,454
  • 2
  • 20
  • 35
6
votes
1 answer

Traverse directory tree in node.js using RxJs

I'm trying to traverse directory tree using RxJs and node.js. I came up with working solution: const filesInDir = Rx.Observable.fromNodeCallback(fs.readdir) const statFile = Rx.Observable.fromNodeCallback(fs.stat) const listFiles = (prefix, dir =…
Jakub Fedyczak
  • 2,174
  • 1
  • 13
  • 15
1 2 3
99
100