Questions tagged [reactive-extensions-js]

The Reactive Extensions for JavaScript is a set of libraries to compose asynchronous, resilient and responsive event driven programs using observable collections with ECMA Script5 Array#extras style composition in JavaScript.

121 questions
6
votes
1 answer

RxJS multiple subscriptions for Observable.Interval

Is there any solution like following one for RxJS? Is it possible to invoke subscribers's OnNexts on different threads in Rx? P.S. My first, naive approach(in CoffeeScript) had obviously failed: hObs = Rx.Observable.interval(35000) …
Daniel K
  • 91
  • 1
  • 6
5
votes
4 answers

Creating a filterable list with RxJS

I'm trying to get into reactive programming. I use array-functions like map, filter and reduce all the time and love that I can do array manipulation without creating state. As an exercise, I'm trying to create a filterable list with RxJS without…
5
votes
2 answers

Testing Subject using TestScheduler in RxJs

I am using RxJs to count how many packets arrive in a particular time window. My code basically looks like this: var packetSubject = new Rx.Subject(); var packetsInWindow = []; function startMonitoring() { var subscription = packetSubject …
lem1x
  • 35
  • 1
  • 8
5
votes
1 answer

How do I sync RxJS updates so that intermediate values aren't passed through the stream?

In my system I have a source, two "steps" that map the source to a new value, and then a sum that combines those two steps to create a final value. The initial run through of this system works as I hoped, generating a single sum of 3. var source =…
Jesse Grosjean
  • 607
  • 4
  • 10
5
votes
2 answers

Create a Observable that delays the next value

I'm trying to create an observable using RxJS that does what is pictured. Grabs a value and waits a fixed period of time before getting the next one. The next one will be the last value emitted in the period of the wait, skipping the rest. If an…
queimadus
  • 81
  • 6
5
votes
1 answer

Collect RxJS Observable to Array

I'd like to use RxJS to "bridge" async world of events with sync world. Specifically I want to create an function which returns an array of events collected during some time interval. I can create Observable which does what I want var source =…
apolenur
  • 335
  • 5
  • 11
5
votes
1 answer

RxJS is to events as promises are to async

In Requesting a clear, picturesque explanation of Reactive Extensions (RX)? I asked about what RX is all about, and I think, thanks to the provided answers I now got the idea. In the referenced question i quoted a sentence from…
Golo Roden
  • 140,679
  • 96
  • 298
  • 425
4
votes
3 answers

RxJS - Continue sending notifications after error occurs in onNext

I am new to Rx, and I would really appreciate a little help with error handling. I have the following code, which is basically a typeahead: var observable = Rx.Observable.fromEvent(searchField, 'keyup') .map(ev => ev.target.value) …
Roxana
  • 87
  • 2
  • 5
4
votes
1 answer

RxJS: Reactive-Extensions for JavaScript with Angular 2

Can someone explain to me why Angular 2 requires the RxJS library and how it exactly relates to Observables & Angular 2
Ray Kim
  • 1,931
  • 1
  • 13
  • 25
4
votes
1 answer

How to create an Observable that only fires when it has subscribers, and provides the latest value to new subscribers immediately

I'm trying to create a stream/observable that... Only outputs events when it has subscribers Provides any new subscribers with the latest value. The concrete case is that I need an observable that makes an Async API call whenever a particular…
gargantuan
  • 8,888
  • 16
  • 67
  • 108
4
votes
1 answer

Ensure order that subscribers get updated

Is there a way to make sure the order on how subscribers get updated is ensured? I've got a hot observable and my first subscriber does some sync work to update a variable and my next subscriber then has to initialise a service (only once!), and…
4
votes
2 answers

How to store accumulated result of a scan with rxjs

I have two merged observables with a scan after the merge. The first one is a simple range and the other is a Subject. Whenever the Subject emits a new value with onNext I concatenate that value in the scan and return the new array as the…
4
votes
2 answers

Separating single clicks from click and hold

I need to implement a behavior: when element clicked - one thing happens but when it's clicked and held for more than one second, something else happens (e.g element becomes draggable) and then the first event never fires I think I know how to…
iLemming
  • 34,477
  • 60
  • 195
  • 309
4
votes
2 answers

Create infinite repeatable Observable from array

Let's say I have an array items I know I can create an observable from this array using Rx.Observable.fromArray(items) How do I create a lazily infinitely repeating observable from this (i.e.: repeating the items as long as they are being…
Yousef
  • 876
  • 6
  • 13
4
votes
2 answers

side effects that create resources in rx (reactive extensions)

The rx guidelines say to avoid side effects when possible, and put them in do() (doAction in js) clauses if they are unavoidable. However, a very common side effect in a UI is to create some resource (say a
) that is referenced down-stream (by…
user1009908
  • 1,390
  • 13
  • 22
1 2
3
8 9