1import { merge, Observable, timer } from 'rxjs'; 2import { mapTo, takeUntil } from 'rxjs/operators'; 3 4/** 5 * @internal 6 */ 7export type WithLoadingIndicatorOptions<T> = { 8 whileLoading: T; 9 source: Observable<T>; 10}; 11 12/** 13 * @internal 14 */ 15export function withLoadingIndicator<T>({ whileLoading, source }: WithLoadingIndicatorOptions<T>): Observable<T> { 16 return merge(timer(200).pipe(mapTo(whileLoading), takeUntil(source)), source); 17} 18