RxJS - split Observable into two, wait for first to finish

feerlay

I have an Observable that looks more or less like this:

-a--b-c---d--e----f--->

where a, b, c, d, e, f are emitted values.

I want to split this Observable into two Observables, in such way that the last emitted value is "alone".

-a--b-c---d--e-------->

------------------f--->

Now, I want to wait for first Observable to completely finish (even inner Observables), after that, execute second Observable.

I know, that I should probably use concat, but I'm actually struggling with splitting Observable into two

martin

This seems fairly simple because there are skipLast and takeLast operators:

const source = ...;

const first = source.skipLast(1);
const second = source.takeLast(1);

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

How to wait for first Observable to finish before executing others in parallel using RxJS

Will the second Await call of two wait for the first to finish?

RXJS Emit first result and then wait for another observable

RxJS wait for previous execution to finish

Wait for two observables to finish

Wait for two sequences to finish

Angular 5, rxjs- wait for observable to finish only if it is in a middle of a run before running another process

Observable wait for a function with multiple observable to finish

TypeScript - wait for an observable/promise to finish, and return observable

how to wait for first command to finish?

Python : Wait for the first subprocess to finish

Angular rxjs: method does not wait for promise to finish

Wait on RxJs.Subscriptions to finish before resuming

RxJS Waits until Subscribe Observable Finish

Wait multiple observable requests to finish using RXSwift

Cancel Observable subscription and wait for Observer to finish

RxJS (Interval) Observable wait for last observable to complete

RxJS wait for observable then create another observable, and so on

Create two sequence http request by coroutine. Second request must wait when finish first

RxJS: Combine two observables so the observable only emits if the value of the first observable is true

Angular Wait an Observable to finish before starting other Observable

Make second pipe not wait for the first one to finish

Split an Observable of list in two

How to wait in Angular for two calls to finish

wait for two subscribe to finish without nesting

How to 'wait' for two observables in RxJS

RxJS wait for an observable to complete in its entirety

Rxjs observable wait until some condition is met

Wait for an async operation in onNext of RxJS Observable