Questions tagged [reactivex]

ReactiveX is a library for composing asynchronous and event-based programs by using observable sequences.

From reactivex.io:

It extends the observer pattern to support sequences of data and/or events and adds operators that allow you to compose sequences together declaratively while abstracting away concerns about things like low-level threading, synchronization, thread-safety, concurrent data structures, and non-blocking I/O.

688 questions
10
votes
3 answers

Equivalent of RxJS switchMap in ReactiveX/Rx.NET

In RxJS, there is a switchMap function. Is there an equivalent in ReactiveX/Rx.NET? I don't see one in the transforming documentation.
wonderful world
  • 10,969
  • 20
  • 97
  • 194
9
votes
1 answer

What kinds of changes do ViewChildren and ContentChildren QueryLists listen for?

Let's say you had the following code: And somewhere else the code: What are the changes that would cause () => {} to be called? What about @ContentChildren()? I couldn't find any documentation on this. Additionally, is there a way to get more…
NetherGranite
  • 1,940
  • 1
  • 14
  • 42
9
votes
1 answer

Convert array to sequence of items with flatMap

In RxJS I want to convert an array that I have at some point into a sequence of items that are in the array. I found two ways to do it: Option 1 & 2, which I guess, do the same thing: const obj = { array: [1, 2, 3, 4, 5] }; const observable =…
dragonfly
  • 17,407
  • 30
  • 110
  • 219
9
votes
3 answers

How do I repeat an ajax request until a condition is met with RxJS Observable?

I'm attempting to repeat a request until the response has data using RxJS, at which point I'd like to call a success (or failure) handler, but I'm having trouble w/RxJS. Here's my current approach: // ... redux-observable action…
seitzej
  • 131
  • 1
  • 7
9
votes
3 answers

Why I am getting NoClassDefFoundError: org/reactivestreams/Publisher

Stream.java import io.reactivex.*; public class Stream { public static void main(String args[]) { Observable.just("Howdy!").subscribe(System.out::println); } } build.gradle: group 'com.sakhunzai' version '1.0-SNAPSHOT' apply…
sakhunzai
  • 13,900
  • 23
  • 98
  • 159
9
votes
2 answers

Where is Observable#asObservable() in RxJava2?

I would like to observe my BehaviourSubject. In RxJava 1 I was calling asObservable(), which is now gone. I found publish() but it returns connectable, which I don't want to. How to turn behavior subject into observable in RxJava 2?
Dims
  • 47,675
  • 117
  • 331
  • 600
9
votes
3 answers

Why does my RxJava Observable not emit or complete unless it's blocking?

Background I have a number of RxJava Observables (either generated from Jersey clients, or stubs using Observable.just(someObject)). All of them should emit exactly one value. I have a component test that mocks out all the Jersey clients and uses…
Rowan
  • 2,585
  • 4
  • 24
  • 34
8
votes
2 answers

Kotlin: How to check variable with lateinit property is initialized or not

I have a variable that is declared like private lateinit var apiDisposable: Disposable and then in onPause() method, I am doing override fun onPause() { super.onPause() if (!apiDisposable.isDisposed) apiDisposable.dispose() } But I…
Kishan Solanki
  • 13,761
  • 4
  • 85
  • 82
8
votes
2 answers

RxJS Custom Operator Internal Variables

Are there drawbacks to using/mutating a variable from a custom operator closure in RxJS? I realize it violates the "pure" function principle and that you can use scan for this simple example, but I'm asking specifically for tangible technical issues…
JeffD23
  • 8,318
  • 2
  • 32
  • 41
8
votes
1 answer

Make Http call using ReactiveX for Java

I am new to ReactiveX for Java and I've the following code block that make external http call but it is not async. We are using rxjava 1.2, and Java 1.8 private ResponseEntity callExternalUrl(String url, String json, HttpMethod method) { …
WowBow
  • 7,137
  • 17
  • 65
  • 103
8
votes
2 answers

How to map RxSwift Observable and Result

I have a quick question: I have a network request that returns Observable>, let’s call it requestToken if this request succeeds, I want to use the String (token) to do another request that returns…
Rodrigo Ruiz
  • 4,248
  • 6
  • 43
  • 75
8
votes
2 answers

RxJava merge debounced and not debounced observables

I have two observables: Observable O(open): file with some content opened in textview Observable E(edit): file content edited in textview I want to debounce E observable, and merge it with O observable. obs = Observable.merge(E.debounce(2000,…
wilddev
  • 1,904
  • 2
  • 27
  • 45
8
votes
3 answers

Filter an observable by an observable

Let's consider the following simplified situation: We have an Observable apples of type Observable < Apple > Every Apple object has a method isRotten() which returns an observable of type Observable < Boolean > which is guaranteed to emit at least…
Ward Beullens
  • 393
  • 5
  • 18
8
votes
2 answers

ReactiveX emit null or sentinel value after timeout

Looking for a clean way to transform a source Observable to emit a single null (or sentinel value) after not emitting an item for some duration. For example, if the source observable emits 1, 2, 3 then stops emitting for 10 seconds before emitting…
jenglert
  • 1,589
  • 15
  • 23
8
votes
2 answers

ReactiveX: Group and Buffer only last item in each group

How to group an Observable, and from each GroupedObservable keep in memory only the last emitted item? So that each group would behave just like BehaviorSubject. Something like this: {user: 1, msg: "Anyone here?"} {user: 2, msg: "Hi"} {user: 2, msg:…
Dzmitry Lazerka
  • 1,809
  • 2
  • 21
  • 37
1 2
3
45 46