Questions tagged [observable]

An observable is typically a programming construct that can be "watched" by other parts of the code, called the "observers". Different frameworks and programming languages have different implementations for observables, so this tag should typically be used in conjunction with others.

An observable is typically a programming construct that can be "watched" by other parts of the code, called the "observers". Different frameworks and programming languages have different implementations for observables, so this tag should typically be used in conjunction with others.

An observer may be any object that implements interface Observer. An observable object can have one or more observers. After an observable instance changes, an application calling the Observable's “notification” method causes all of its observers to be notified of the change by a call to their update method.

References

9527 questions
3
votes
2 answers

Observable property allowing to add observers at runtime

Via Delegates.observable, Kotlin permits observable properties. I need, however, the ability of adding observers at runtime, as Java's Observable class does. What I have now, is the following: import java.util.* import…
JohnB
  • 13,315
  • 4
  • 38
  • 65
3
votes
2 answers

Combining/merging observables

Suppose I'm developing a chat app. I have observable threads$ that emits array of threads every n seconds, observable offline$ that notifies when a thread became offline, observable online$ that notifies when a thread became online: enum…
embarq
  • 335
  • 1
  • 9
3
votes
1 answer

Angular2 - How to chain async http requests and stop if fails

I have an array of HTTP requests that I need to fire in certain order, but if any of the previous one fails then none of the following ones is going to be executed. How can I achieve that? What's the best approach? I need something like: let…
karruma
  • 768
  • 1
  • 12
  • 32
3
votes
1 answer

angular 4 observable catch service undefined

I have a service to work with the interact with the backend. The am looking to catch 401 status, indicating the user has been logged out by the backend (token expiration). So when I catch a 401, I save off the current route, and navigate them to…
Geoff Lentsch
  • 1,054
  • 11
  • 17
3
votes
2 answers

Angular v4: Search by name with observable

I'm using Angular v4 and I want to add the ability to search by name, so I have created an service that allow to get list of movies: import { Injectable } from '@angular/core'; import { Http, Response } from '@angular/http'; import { Observable…
Alessandro
  • 905
  • 3
  • 17
  • 32
3
votes
1 answer

Accessing NeDB find() results

I'm making an app with Angular 2 and Electron and using NeDB as a data storage. The search service is intended to handle operations with DB, for now I want it to load whole database and return it. search.service.ts import { Injectable } from…
Ivan Bespalov
  • 147
  • 1
  • 12
3
votes
1 answer

Zip operator in RxJava is not working with Retrofit

I am trying to use zip operator in RxJava in android, where I am trying to execute 3 parallel API Calls to get their result together. But my zip operator is not producing result. The code for my sample problem is as follows: Code for my gradle…
Umang Bhola
  • 97
  • 1
  • 3
  • 9
3
votes
1 answer

Is there a way to split one item in a stream into multiple items?

Consider the following stream: --'[a,b,c]'-- The '[a,b,c]' is one item in the stream. Now I'm looking for a way to map that stream into this: --'a'--'b'--'c'-- I think at some point I need to use map since I only know how to split the…
Mehran
  • 15,593
  • 27
  • 122
  • 221
3
votes
1 answer

Observable create is called twice

I am using Ionic3 with a rxjs/Observable. I have the following function, and for some reason, even though the function is only called once, the 3rd line gets fired twice. findChats(): Observable { return Observable.create((observer) => { …
Richard
  • 8,193
  • 28
  • 107
  • 228
3
votes
3 answers

Setting LOCALE_ID from Observable Service

I have a service that provides the global app language as follows: export class LanguageService { private currentLanguage$ = new ReplaySubject < string > (); getCurrentLanguage(): Observable < string > { return…
Sammy
  • 3,395
  • 7
  • 49
  • 95
3
votes
1 answer

Create RxJs observable based on method availability

I would like to wait for a method availability before to be executed using RxJs observable and TypeScript inside an Angular 4 application. So far I came up with using interval combine with skipWhile but I was wondering is there a better way to just…
j3ff
  • 5,719
  • 8
  • 38
  • 51
3
votes
1 answer

rxjs returning different Observable depending on answer from first

I have a function which accesses two Observables and returns an Observable. At first the first Observable is subscribed. Depending on its answer a second Observable has to be subscribed (also passing a value from first Observable to it) or not. But…
daign
  • 899
  • 1
  • 10
  • 18
3
votes
1 answer

What's the difference between InvalidationListener and ChangeListener?

As you know an ObservableValue in java can generate two types of events: Invalidation and Change. I don't know what's the difference between them? When we should use Invalidation or Change Listener?
Mohammad Sadegh
  • 747
  • 11
  • 25
3
votes
3 answers

You provided an invalid object where a stream was expected. You can provide an Observable, Promise, Array, or Iterable

Say I have the following function references: const externalRequests = (params) => Rx.Observable.zip( externalApi1(params), externalApi2(params) ) and const internalDB = (params) =>…
Abraham P
  • 15,029
  • 13
  • 58
  • 126
3
votes
3 answers

Angular Looped HTTP Request Map Value to Responses

In my service class I am looping an http get request and using rxjs forkJoin to combine all the responses into an observable which I return to my component. For each response that comes back I need to add two properties to the json (readySystem…
HendPro12
  • 1,094
  • 3
  • 17
  • 50