rxjs5

Angular2 NGRX Performance Issues On Dispatch?

故事扮演 提交于 2019-12-06 06:08:40
I've been working on an application in Angular2/CLI/NGRX and things have been going well until recently. I'm noticing some pretty big spikes in performance especially with consecutive dispatches within the same container. For example lets say I have the following defined: public appEnvironment$: Observable<IEnvironment>; public assessment$: Observable<IAssessment>; public assessmentComments$: Observable<ICommentActivity[]>; public assessmentEvidence$: Observable<IEvidenceActivity[]>; public assessmentIssues$: Observable<IIssueActivity[]>; public assessmentSurvey$: Observable<ISurvey>; public

Chained redux-observable epic only fires correctly once

拈花ヽ惹草 提交于 2019-12-06 05:54:11
I've set up an epic that waits for another epic to complete, much like @jayphelps' answer here: Invoking epics from within other epics However I've found that it only seems to run once. After that I can see the CART_CONFIG_READY action in the console but the DO_THE_NEXT_THING action is not triggered. I've tried various combinations of mergeMap and switchMap , with and without take but nothing seems to help. This is (kind of) what my code looks like. import { NgRedux } from '@angular-redux/store'; import { Observable } from 'rxjs/Observable'; import { ActionsObservable } from 'redux-observable'

How to use the 'flatmap' operator conditionally ? (Angular 2/rxjs)

眉间皱痕 提交于 2019-12-06 05:16:32
问题 What I'm trying to achieve is to run a series of observables conditionally. return observable.map(response => response) .flatmap(response1 => observable1(response1)) .flatmap(response2 => observable2(response2)) .flatmap(response3 => observable3(response3)) I need to check the response1 and invoke the remaining observables if needed, else I need to return response1 and break the execution and so on. I've gone through the following SO questions but they doesn't seem to answer my question

How to resumeOnError (or similar) in RxJS5

拜拜、爱过 提交于 2019-12-06 05:01:52
I would like to use the onErrorResumeNext feature of RxJS, i.e. to continue to receive events even if an error is received (instead of terminating). But I can see in the following doc that there is no correspondance in RxJS5: https://github.com/ReactiveX/RxJS/blob/master/MIGRATION.md . Is there a workaround to use such feature? Thanks! I've been looking for that operator too! I came up with a solution for my needs that I hope will help yours. It's not the best solution most likely, but I hope it can help until a better solution can be found by some others on here, or until this operator is

Fork join two firebase observables

耗尽温柔 提交于 2019-12-06 04:47:43
问题 I am using angular2fire. I am querying and trying to get all the tours from a city. getAllTours(cityId) { return this.af.database.list(`/cities/${cityId}/tours`) .map((tours): any => { tours.map((tour: any) => { tour.tour = this.af.database.object(`/tours/${tour.$key}/tours`) }); return tours; }) } If i console.log the tour object, i get a array of "FirebaseObjectObservable". I have to loop through all the FirebaseObjectObservable, to get the actual data. I was wondering if i could forkJoin

Rate-limiting and count-limiting events in RxJS v5, but also allowing pass-through

我怕爱的太早我们不能终老 提交于 2019-12-06 04:25:54
I have a bunch of events to send up to a service. But the requests are rate limited and each request has a count limit: 1 request per second: bufferTime(1000) 100 event items per request: bufferCount(100) The problem is, I am not sure how to combine them in a way that makes sense. Allowing pass-through Complicating this further, I need to make sure that events go through instantaneously if we don't hit either limit. For example, I don't want it to actually wait for 100 event items before letting it go through if it's only one single event during a non-busy time. Legacy API I also found that

Understanding back-pressure in rxjs - only cache 5 images waiting for upload

我只是一个虾纸丫 提交于 2019-12-06 03:24:03
问题 I am working on a node project that needs to submit thousands of images for processing. Before these images are uploaded to the processing server they need to be resized so I have something along the lines of this: imageList .map(image => loadAndResizeImage) .merge(3) .map(image => uploadImage) .merge(3) .subscribe(); Image resizing typically takes a few tenths of a second, uploading and processing takes around 4 seconds. How can I prevent thousands of resized images building up in memory as

Angular 2 RxJS check if mouse event is still active after delay

安稳与你 提交于 2019-12-06 02:46:16
问题 I'm using Angular 2 to make a directive. I have the following events bound to the host component: host: { '(mouseenter)': 'onMouseEnter($event)', '(mouseleave)': 'onMouseLeave($event)' } I also created two streams and listeners on the directive to manage the two events export class PopupDirective { private _mouseEnterStream: EventEmitter<any> = new EventEmitter(); private _mouseLeaveStream: EventEmitter<any> = new EventEmitter(); onMouseEnter($event) { this._mouseEnterStream.emit($event); }

Conditional emission delays with rxjs

匆匆过客 提交于 2019-12-06 00:43:39
From picture to code? How to get the Out observable from Data and Gates? Data is an observable of any kind e.g. JSON objects to be sent to a remote backend Gates is a boolean observable, where the ticks correspond to true and the crosses to false. For example, Internet connectivity whereby true means the network became accessible and false reflects a disconnection. Out is the resulting observable, which emits the same as Data, sometimes immediately, sometimes with a delay, depending on the gate that preceded. For instance, I could subscribe to the Out in order to post the emitted JSON objects

RxJS5 finalize operator not called

二次信任 提交于 2019-12-05 22:37:21
问题 I'm trying to trigger a callback when all my observables are executed. In my other, older project i used finally like so and that worked like a charm: this.myService.callDummy() .finally(() => console.log('Works!')) .subscribe(result => ...) But now I'm using a newer version of RxJS with Pipeable operators , but the finally call (now renamed to finalize ) never gets executed. There is little information to be found and I'm not sure what I'm doing wrong. combineLatest( this.route.queryParams,