I am trying to run observables in sequence (when firstObservableStream is done, then deal with secondObservableStream). This whey i am trying to emulate some async stuff. For example delete-old-image --> upload new image ---> subscribe to output and so on.
I have a short example code:
import { Observable, of } from 'rxjs';
import { merge, concat } from 'rxjs/operators';
const emmit$ = Observable.create(function(observer) {
setTimeout( ()=> observer.next('emmit #1'), 40);
setTimeout( ()=> observer.next('emmit #2'), 5000);
});
const process$ = Observable.create(function(observer) {
setTimeout( ()=> observer.next('process #1'), 2500);
setTimeout( ()=> observer.next('process #2'), 400);
});
const combined$ = emmit$.pipe(concat(process$));
combined$.subscribe( (val) =>{
console.log(val);
});
What i expect as output: emmit#1 --> emmit#2 --> process#1 --> process#2
And the real output is: emmit#1 --> emmit#2
Like if $process do not participate in sequence at all