reactive-programming

Observable do not receive the next value in angular2

こ雲淡風輕ζ 提交于 2019-12-13 06:26:31
问题 In order to pass value between angular2 different components, I use different services injected into different components. In my PagesService component, I define a behavior subject and want to pass a value. import { Injectable } from '@angular/core'; import { ApiService } from '../../apiService/api.service'; import { Playlists } from '../shared/playlists.model'; import { Subject, BehaviorSubject } from 'rxjs/Rx'; @Injectable() export class PagesService { private currentPlaylists: Subject

How to mock Mono.create

隐身守侯 提交于 2019-12-13 03:58:21
问题 I'm using the spock framework and need to return a mocked Mono from a Mono.create(..) I've tried: GroovyMock(Mono) as well as GroovyMock(Mono, global:true) 1 * Mono.create(_ as MonoSink) >> Mono.just(returnedValue) But I get the message that there were too few assertions for the above code. Here is the actual Mono.create code Mono.create{ sink -> myAPISoap.getStuffAsync( username, password, info, { outputFuture -> try { sink.success(outputFuture.get()) } catch(Exception e){ sink.error(e) } }

ReactiveUI - WhenActivated and Output Properties

只愿长相守 提交于 2019-12-13 03:46:27
问题 I'm using ReactiveUI and I'm trying to change all my ViewModels' rules with WhenActivated but I'm unable understand how to have it working well in conjunction with output properties. The pattern is something like this.WhenActivated( registerDisposable => { registerDisposable(this.Bind(…)); registerDisposable(this.WhenAny(…)); registerDisposable(this.WhenAnyValue(…)); }); and the output properties looks like protected readonly ObservableAsPropertyHelper<object> _Obj; public object Obj => _Obj

Why isn't bar plot updating based on reactive data frame?

半世苍凉 提交于 2019-12-13 03:07:57
问题 Question Despite both sharing the same reactive data frame, why does the bar plot not match the data shown in the table in my shiny app? Overview I'm currently arranging the iris data frame in df - a reactive expression that uses the input of a radio button and arranges the data based on base::switch(). Afterwards, df is displayed in two forms: a bar plot and a table. The trouble is that the bar plot doesn't respond to the radio button, while the table does. My desired output would be for the

How to put a reactive Template inside of a Surface in famo.us/Meteor

被刻印的时光 ゝ 提交于 2019-12-13 02:13:26
问题 I've read several posts on this but nothing that would really answer my question in an up-to-date way (i.e. UI.insert is depreciated). So what's the best way of inserting/rendering a Template into a Surface reactively, meaning, not only one data object (renderWithData), but whatever is defined in the Template.helpers should also be updated reactively. Code tried so far: var div = document.createElement('div'); //UI.insert(UI.render(function() { return Template.hello; }), div); surface = new

RxJava debounce by arbitrary value

我是研究僧i 提交于 2019-12-12 20:47:44
问题 Still figuring out a proper use of different Rx* operators and stumbled upon the following problem: I have a collection of models of the following type: class Model { final long timestamp; final Object data; public Model(long timestamp, Object data) { this.timestamp = timestamp; this.data = data; } } This collection is sorted in ascending order (sorted by timestamp). My goal - is to group them by "sequences". "Sequence" - is sequence of elements where each element is really close to its

how should I keep a running total of several values with bacon.js?

偶尔善良 提交于 2019-12-12 20:39:04
问题 Messing around with a bacon.js. I'd like to keep a running total of values in a group of text inputs. The example on the github site uses .scan and an adder function, which works fine for the example because it's using -1 and +1 in the stream. But I'd like values to be removed from the stream if they are edited, so the .scan solution won't really work for me or I'm not doing it right. Markup: <ul style="repeat-direction: vertical; list-style-type: none;"> <li><input data-group="0"></li> <li>

Rxjava tolist() not completing

僤鯓⒐⒋嵵緔 提交于 2019-12-12 19:17:16
问题 I have a problem with my RxJava callchain. The toList is not working properly. I would guess that it is that the toList() needs something to complete. That is why it is stuck. But i do not know how to solve this issue The code mModel.getLocations() .flatMapIterable(new Function<List<Location>, List<Location>>(){ @Override public List<Location> apply(final List<Location> locations) throws Exception { return locations; } }) .filter(new Predicate<Location>() { @Override public boolean test(final

rx data driven subwidgets

一曲冷凌霜 提交于 2019-12-12 18:28:01
问题 Following up on How to structure rxjs code, concerning how to structure a widget with subwidget when using rx, how would you structure rx code where the subwidgets are data-driven? As a toy problem, suppose you have an external source (e.g. web service) streaming a list of stocks to watch, with value, high, low, etc. So you have an Observable stream like (time goes down): [{id: 'csco', value: 12, high: 20, low: 10}] [{id: 'csco', value: 12, high: 20, low: 8}, {id: 'aapl', value: 29, high: 30,

How to Transform Observable<Observable<List<T>>> to Observable<List<T>>

ε祈祈猫儿з 提交于 2019-12-12 17:52:14
问题 I am stuck on how to convert/transform the following observable type to my target type: I have observable of type: Observable<Observable<List<FooBar>>> I want to convert it to: Observable<List<FooBar>> So when I subscribe on it, it emits List<FooBar> not Observable<List<FooBar>> I tried with map, flatMap... I could not find a solution. However, I found a strange looking operator called blockingFirst which my IDE indicates that it returns Observable<List<FooBar>> when applied to Observable