André Staltz (@andrestaltz): You will learn RxJS at ng-europe 2016
Why Stack Overflow recommends it
Stack Overflow users link it when explaining what an RxJS Observable really is, how operator chains run, and as a guide for building a minimal Rx implementation.
Recommended by 1 people across 3 different months, 2017 to 2020.
What it is
A 22-minute conference talk from ng-europe 2016 in which André Staltz live-codes a basic Observable and a few operators from scratch to demystify RxJS. He then shows how this model solves async event problems.
What people said
Recommends Sasxa · 2017-03 · Stack Overflow · on “RxJS Observable returns data immediately, why?”
An Observable is essentially just a wrapper for onSuccess() , onError() and onComplete() callbacks. If functions that are executed are synchronous an Observable will be too. This is core functionality of an Observable (the rest is just cleanup): export class Observable { constructor(subscribe) {} subscribe(observerOrNext, error, complete) {} // callbacks } Observable.create = (subscribe) => { return new Observable(subscribe); // dot-chaining } Watch this video [this video] where André Staltz constructs observable from scratch.
Recommends Sasxa · 2017-04 · Stack Overflow · on “Angular, observable subscribing to promise”
You have to remember that Promise and Observable are "just" wrappers for callbacks. When you chain then() s in Promise chain or use operators with Observable chains you are passing function or a value from one callback to the next. Consider this fake code: const fn = (something) => { return other(something); } Observable.from([1, 2, 3]) .map(o => fn(o)) .swithMap(o => Promise.resolve(o => fn(o))) .swithMap(o => Observable.of(o => fn(o))) You use switchMap() to get a value from some wrapped callback asynchronously (either from Promise, or Observable). map() is a synchronous operator and you are dealing with values directly. If you want more details about how things work, watch this awesome ta
Recommends Sasxa · 2017-10 · Stack Overflow · on “How to get current value of State object with @ngrx/store?”
@Forge_7 You can thing of observable chain as series of nested functions, `subscribe(take(store(() => {...})))` so they will execute in order before next line. This is of course oversimplified.. watch this video [this video] to learn how it works.
Cites Sergey Karavaev · 2017-06 · Stack Overflow · on “Emit action, then request and emit another with redux-observable and rxjs”
If I got it right, you want your epic to produce the following sequence of actions in response to each SUBMIT_LOGIN : GENERATE_DEVICE_ID -- RESOLVE_LOGIN -- LOAD_ABOUT Also, I guess that GENERATE_DEVICE_ID needs to be issued immediately after SUBMIT_LOGIN is received, while RESOLVE_LOGIN and LOAD_ABOUT should be issued only after a stream returned by login() emits. If my guess is correct, then you just need to start the nested observable (the one created per each SUBMIT_LOGIN ) with GENERATE_DEVICE_ID action and startWith operator does exactly that: const submitLoginEpic = action$ => action$.ofType(SUBMIT_LOGIN) .mergeMap(({ payload }) => login(payload.email, payload.password) .mergeMap(({ r
Cites Sergey Karavaev · 2017-08 · Stack Overflow · on “ngrx ofType, @ngrx/effects”
In a nutshell, when .ofType() gets called, it subscribes to the source stream of actions and pushes matching actions to the resulting stream. So it is indeed called once. If we look at the source code [LINK] , we'll see that under the hood ofType uses filter operator of rxjs library, meaning that this.action$.ofType(CREATE_TASK) can be expanded to this.action$.filter(action => action.type === CREATE_TASK) Description of how filter works can be found from rxjs docs [LINK] : Similar to the well-known Array.prototype.filter method, this operator takes values from the source Observable, passes them through a predicate function and only emits those values that yielded true . It's worth noting tha
Cites HDW · 2020-01 · Stack Overflow · on “Kotlin: Type mismatch between interface generic type T and parameter object type T”
As an exercise to understand ReactiveX better I'm trying to implement the very basics of ReactiveX in Kotlin (guided by the RxJs example here [this video] ). I think the idea behind what I currently get is correct, but I'm stuck with one implementation detail that I can't get my head around. This is the Observer interface: interface Observer<T> { fun next(data: T) fun error(e: Throwable) fun complete() } This is the Observable Interface: interface Observable<T> { fun subscribe(observer: Observer<T>) fun <T, R> map(transformer: (input: T) -> R): Observable<R> { val inputObservable = this val outputObservable = object : Observable<R> { override fun subscribe(outputObserver: Observer<R>) { inputObse
Cites Shorbagy · 2020-08 · Stack Overflow · on “How to pass results between chained observables”
You're right about these concerns and problems you mentioned but the problem I see here is turning your mindset from an imperative approach to a Reactive/Functional approach but let us review the imperative code first private startUpload(event: StartUploadEvent) { const headers = this.getAuthenticationHeaders(event) const id = this.generateUploadId() this.emitUploadStartEvent(id, event) const pdfId = this.createPdfDocument(event, headers, id) this.uploadBilderForPdf(event, pdfId, headers, id) const cloudId = this.closePdf(headers, pdfId) this.emitUploadDoneEvent(id, event, cloudId) return cloudId } Here you see the stuff is more clean that you have event that you can pass and get only what y