Hellow, I'm trying to create an observable (OBS) and subject (SUB) function that saves the last element from OBS, while SUB has the value F, and emit it (and only it) when the SUN becomes T
OBS
SUB
OUT
I tried to solve this problem with
OBS.window(SUB)
.withLatestFrom(SUB)
.switchMap(([window, status]) => {
if(status === F) {
return window.combineLatest(SUB, (cmd, status) => {
if(status === T) {
return null;
};
return cmd;
}).last((e) => {
return !!e;
})
}
return Observable.empty<Command>();
}).filter((cmd) => {
return !!cmd;
})
but it does not work
source
share