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
12
votes
3answers
894 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 ...
11
votes
1answer
23k 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 ...
5
votes
1answer
11k 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 ...
5
votes
1answer
150 views

Video downloader app implemented in RxJs

I have used multiple map/flatmap combinations. Could anybody help me with the review? ...
5
votes
1answer
39 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 ...
4
votes
0answers
105 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: ...
3
votes
1answer
447 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 ...
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 ...
3
votes
1answer
93 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 ...
3
votes
0answers
67 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. ...
3
votes
0answers
107 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: ...
3
votes
0answers
3k 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, ...
3
votes
0answers
84 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
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 ...
2
votes
1answer
6k 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 ...
2
votes
1answer
108 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 ...
2
votes
1answer
89 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
64 views

Is returning promise form angular service bad?

What is the problem when I return a promise from angular service instead of Observable? If it's a matter of any manipulation or side-effect, that I can easily do ...
2
votes
1answer
63 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 ...
2
votes
1answer
301 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, ...
2
votes
0answers
86 views

IndexDB (RxJs) - Angular Service

Inspired by Wrapping IndexDB with RxJs. (Edit - Added a Stackblitz example). My use case is a simple, on-disk temporary cache. No errors are propagated, null ...
2
votes
0answers
28 views

Credit Card Form using RXjs

I am trying to improve my skills and I'd like to work on avoiding bad practices and mistakes. Can anyone skim over my code and point out what should have been implemented more efficiently or in a ...
2
votes
0answers
31 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 ...
2
votes
0answers
38 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 ...
2
votes
0answers
2k 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 ...
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
334 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 ...
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 ...
1
vote
1answer
320 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
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 ...
1
vote
1answer
4k 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. ...
1
vote
0answers
49 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 ...
1
vote
0answers
23 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 ...
1
vote
0answers
31 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 ...
1
vote
0answers
347 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 ...
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 ...
1
vote
0answers
161 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. ...
1
vote
0answers
23 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. ...
1
vote
1answer
38 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 ...
1
vote
2answers
877 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 ...
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
32 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
105 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 ...
0
votes
0answers
41 views

Rxjs - switchMap - countdown timer

I'm learning rxjs and I've implemented my own solution for task: "Countdown timer with pause and resume". Please, do a check review and give me some valueable feedback. Regards https://stackblitz....
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. ...