Can’t find `combineLatest` in RxJS 5.0

I think #1722 is the relevant GitHub issue here. I’m on a project using typescript@2.0.10, RxJS@5.0.3, and webpack@2.1.0-beta.25. The following works for me: import { Observable } from ‘rxjs/Observable’; import ‘rxjs/add/observable/combineLatest’; Observable.combineLatest( source1, source2 ).subscribe(sink);

RxJS takeWhile but include the last value

Since RxJS 6.4.0 this is now possible with takeWhile(predicate, true). There’s already an opened PR that adds an optional inclusive parameter to takeWhile: https://github.com/ReactiveX/rxjs/pull/4115 There’re at least two possible workarounds: using concatMap(): of(‘red’, ‘blue’, ‘green’, ‘orange’).pipe( concatMap(color => { if (color === ‘green’) { return of(color, null); } return of(color); }), takeWhile(color => color), ) … Read more

How to force observables to execute in sequence?

If you want to be sure the order of emissions is the same as the order in which you specified the source Observables you can use concat or concatMap operators. The concat* operators subscribe to an Observable only after the previous Observable completes (it works with Promises as well, see http://reactivex.io/rxjs/class/es6/MiscJSDoc.js~ObservableInputDoc.html). In you case it’d … Read more

Check if object is an Observable

Since writing this answer, RxJS version 6 has been released and, in that version, an isObservable function was added to the public API. It can be imported like this: import { isObservable } from “rxjs”; The function signature is: export function isObservable<T>(obj: any): obj is Observable<T> Since it is defined with a typeguard, the compiler … Read more

Observable forkJoin not firing

forkJoin emits only when all inner observables have completed. If you need an equivalent of forkJoin that just listens to a single emission from each source, use combineLatest + take(1) combineLatest( this.statuses$, this.companies$, ) .pipe( take(1), ) .subscribe(([statuses, companies]) => { console.log(‘forkjoin’); this._countStatus(statuses, companies); }); As soon as both sources emit, combineLatest will emit and … Read more

How does Observables (Rx.js) compare to ES2015 generators?

Observables push changes, and hence the observable, not the function reacting to it, is in control. Generators on the other hand require you to pull values out of them. So the function that will react to the new value determines when it is ready for a new value. I had trouble with backpressure using observables, … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)