function raceWithNotifications<GObservables extends IGenericRaceInObservables>(
observables: GObservables,
): IObservable<IRaceObservableNotifications<GObservables>>raceWithNotifications will wait for the first observable to complete (complete Notification)
and then it will emit the last value received through the next Notifications of this observable.
Finally, it will complete (complete Notification).
It is somehow equivalent of a Promise.race.
const observable1$ = mergeMapS$$(timeout(500), () => singleN<'a1'>('a1'));
const observable2$ = mergeMapS$$(timeout(1000), () => singleN<'a2'>('a2'));
const subscribe = raceWithNotifications([observable1$, observable2$]);
subscribe((value: IDefaultNotificationsUnion<'a1' | 'a2'>) => {
console.log(value);
});Output:
// 500ms
'next', 'a1'
'complete', undefined