Questions tagged [rxjs]

The Reactive Extensions for JavaScript (RxJS) is a set of libraries for composing asynchronous and event-based programs.

Filter by
Sorted by
Tagged with
1
vote
2answers
847 views

Angular2/4 broadcast service using RxJS

I am no expert in RxJS as I am still learning my way around the new paradigm of Observable/Subject. I was trying to implement a broadcast service (based on NgRadio) that allows a new subscriber to ...
-3
votes
0answers
36 views

How to make Observables running in sequence more readable and understandable?

My problem is that I have a http call that returns an Observable that calls another Observable in their subscribe. And in sequence, another observable inside the last calls another one. In my case ...
0
votes
0answers
40 views

Refactor this RXJS code

I have this angular service that is working perfectly but I'm feeling that it isn't very readable. How would you refactor it? (Simple tips as "try this instead of that..." are very welcome. I'm ...
4
votes
0answers
67 views

RxJs memoized singleton selectors

I am working on an angular stack that has n amount of services that hold data in stores of this type: ...
1
vote
0answers
20 views

Making code with interdependant observables reusable

Whenever I find myself repeating the same actions across different components in my projects, I immediately feel that I should extract the code to a function. The problem this time is that I can't ...
7
votes
1answer
695 views

Wrapping IndexDB with RxJs

I find IndexedDB cumbersome and want to wrap the functionality with rxjs observables. I've come up with an angular2 service that seems to fit the bill, but I'm wondering if I'm using the observables ...
2
votes
1answer
263 views

Changing http-requests conditionally

I'm new to RXJS and I have a working piece of code for http-request and subscribing to Observables from a shared service in Angular. This works, but I'd want to get rid of the nested subscriptions, ...
3
votes
1answer
92 views

Store first value of http request with rxjs but keep doing httprequest

With RXJS library : I need to store values from the FIRST http request, but keep doing other http request on demand. I have done this code so far, and that is working. But I think there is a more ...
1
vote
0answers
26 views

Processing the results of API calls and process data

I'm making use of RxJS and observables within my Angular application to process the results of API calls and process data. I've written the component and it works without any issues. However after ...
2
votes
0answers
23 views

RxJs observables pipes SwitchMap and async with typealong search input

I'm using RxJs for type along search, I setup an observable to emit a value after 1 second so it behaves like http with delay. I subscribe to it via the async operator in the template, the component ...
1
vote
1answer
112 views

FormArray total of each formgroup via RxJS

Stackblitz - https://stackblitz.com/edit/angular-plp4rb-formarray-total-prs9ay I'm new to RxJS observables. I've created a form array where the total for a line is ...
1
vote
0answers
202 views

RxJS BehaviorSubject with asynchronous initial value

I am using RxJS to fetch a data structure from a server and cache it, but I also need to be able to overwrite the value locally (specifically, a user operation can change the server state, and the ...
5
votes
1answer
37 views

Merging client names into orders using RxJS

I have an API which I can't modify. I have to use data as it is. I want to join data from two separate requests where the second request is based on data from the first one. I have a working ...
3
votes
0answers
49 views

Implementing custom observable classes

I want to implement my own custom observable class so I can have a hierarchy of components and the closest defined configuration item bubbles to the front. ...
1
vote
0answers
11 views

RXJS and Ionic- Sequencial Subscriptions Waiting on User Action

In an Ionic App a user can open a new browser via "inAppBrowser". I'm trying to get the stats of the user before they go into to the inAppBrowser, get the stats again when browser closes, and then run ...
5
votes
1answer
9k views

RxJS Observable with initial value

Is it possible to get rid of the BehaviourSubject to have an Observable with an initial value? Another thing I don't like is that I'm using getValue() and then modify this value and push it with next ...
2
votes
0answers
36 views

Caching different http-requests

There have been multiple discussions on caching http-requests with RXJS. In this question/proposal I want to propose a custom rxjs-operator (non-pure) to provide ...
1
vote
0answers
100 views

Angular Websocket service with wait for response sending

I am writing an Angular Websocket service that can send messages to a server and then can subscribe to the response. I am grateful for every suggestion to improve this. ...
0
votes
0answers
30 views

Parse json data for forms

I have this form who get all the data from json, and serialized it to make it fill in the UI of material. I was thinking about making a class and name it parses who parse all the data for the ...
3
votes
0answers
105 views

Fetching user information along with user posts in Angular

Here is my code with 2 services, one is messageService which is used to get user messages: ...
2
votes
1answer
94 views

List component using RXJS Angular

I have a small angular project, where I have an Article component to list articles with pagination system. The default page The placeholder loader page The main objectives are: Display the ...
1
vote
0answers
21 views

Angular2 “Logged In State Watcher”

I have a small website I'm working on as a hobby and I created a login page/home page so far. I wanted to get the basic login/logout functionality going before filling out the main part of my site. ...
3
votes
0answers
2k views

Angular async pipe with loading spinner and manual refresh

I have an Angular 6 app with the following requirements: Get data from a web service. Load the data when the page is displayed. Reload the data when the user requests a reload by through some UI, ...
2
votes
1answer
60 views

JavaScript and RxJS Password Strength Indicator

This is my first time using RxJS (or any observable library). It seems to work okay but I'm not sure about best practices. The thing that I am most unsure about is subscribing to the observable ...
0
votes
0answers
36 views

Angular2 and RxJS passing objects around with a service

Let's say I want to share an object between multiple components. This service will allow components to send or receive the object. This functionality allows for an object to be Globally Accessible. ...
3
votes
1answer
336 views

Using RxJS Observables to mediate routes in nodejs

I am learning to be a full stack developer and have been building out an application using Node JS as a backend. Since I have lots of experience using Angular I love RxJS. So naturally I was tempted ...
2
votes
0answers
1k views

RXJS queue up multiple http requests and send when x conditions happens

Just started to use rxjs few weeks ago, I think I'm getting most of it right, but my code seems to be not that efficient and prone to bugs I haven't run into yet! I need to be able to send http ...
1
vote
1answer
37 views

Logging observable values while extending service

I'm trying to extend a service function which returns an Observable<T>. The idea is to extend the function so I can add logging functionality whenever the ...
2
votes
2answers
79 views

Counting quiz for children

I made a game for children. This game tests the ability to count (i.e. compare numbers based on magnitude). First you must select the age of the child in the upper menu, then you need to select blocks ...
3
votes
1answer
3k views

Chaining 3 dependent HTTP request subscriptions one, which is polling

Here is a function that triggers after selecting from a dropdown to choose the floor. As you can see, there are 3 levels of API calls (regular HTTP GET requests with JSON responses) that chain ...
1
vote
1answer
3k views

Angular 2 / rxjs chaining HTTP calls

I have a registration form. Step 1 user creates an account. As user creates an account I need to authenticate user with the created account. in my account.service.ts I have following. Is this the ...
10
votes
1answer
22k views

Angular 2 clock with RxJS Observable

I'm fairly new to Angular 2 and I started off with creating a clock for my app. I tried to stick to the official documentation tutorial. Folder structure: The CSS file is still empty and the HTML is ...
1
vote
1answer
3k views

Call multiple services from angular2 component

This is my first Angular2 component, which makes two api calls: the first call provide the input for the the second one. The following is my attempt at this code. ...
2
votes
1answer
73 views

ReactiveX observable that uses another observable

I am trying to write an Angular service that will wrap the regular Http service and automatically make authentication calls if Bearer token is not available or invalid. Here's an illustration of a ...
2
votes
1answer
86 views

Improving observable persistent queue mini-library

I am creating a small backend library that uses a persistent queue, where the queue is just lines in a text file. The purpose is simply to allow multiple processes to read from the text file, so that ...
2
votes
1answer
5k views

switchMap with array of Observables

I'm trying Rxjs 5 to simplify some Node.js nested callbacks. I need to read a directory (fs.readdir), then read stats of each file (fs.stats) and parse them if they were modified since last sync. The ...
3
votes
0answers
83 views

Angular 2 tagging module with RxJS

I'm currently developing a small Angular tagging module which will enable me to populate an array from a text input, pretty much like Selectize to give an example. I'm using a BehaviorSubject and ...
2
votes
0answers
58 views

Slack bot for miming similar messages

I have a Slack bot that takes a stream of messages and the idea is that if 3 different users repeat the same message, the bot will also mime that message. I am just beginning with RXJS and I am ...
2
votes
0answers
325 views

Wrapping MongoDB Call Results in Observables

I have a number of functions that follow the basic pattern below. The intent is to provide a MongoDB implementation for a storage interface in a TypeScript application. Is there a better way to ...
1
vote
0answers
63 views

REST request using reactive programming

The following code is an extract of a small library I wrote. Full code is available here. My question is about the following function. I added comments on each state. I'm wondering if I could do ...
1
vote
0answers
31 views

Run code after making a certain number of requests using RxJS

I'm experimenting with reactive JS by writing mocha tests. I wrote a test that makes a certain number of requests to an API before stopping. However, this being my first experience with RxJS, I don't ...
1
vote
0answers
104 views

File upload with Node streams

I'm implementing a file upload using NodeJS. I've got fully functional code, however, it feels overly complicated and I'm hoping there would be an easier way to implement the same thing? In ...
5
votes
1answer
147 views

Video downloader app implemented in RxJs

I have used multiple map/flatmap combinations. Could anybody help me with the review? ...