Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import { Observable } from 'rxjs';
- import { debounceTime, distinctUntilChanged, startWith, switchMap } from 'rxjs/operators';
- export function search<T, R>(
- dataCb: (query: string) => Observable<R>,
- delay = 250
- ) {
- return (source$: Observable<T>) => source$.pipe(
- debounceTime(250),
- distinctUntilChanged(),
- startWith(''),
- switchMap(dataCb)
- )
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement