source: trip-planner-front/node_modules/rxjs/src/internal/operators/publishReplay.ts

Last change on this file was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 1.5 KB
Line 
1import { Observable } from '../Observable';
2import { ReplaySubject } from '../ReplaySubject';
3import { multicast } from './multicast';
4import { ConnectableObservable } from '../observable/ConnectableObservable';
5import { UnaryFunction, MonoTypeOperatorFunction, OperatorFunction, SchedulerLike, ObservableInput, ObservedValueOf } from '../types';
6
7/* tslint:disable:max-line-length */
8export function publishReplay<T>(bufferSize?: number, windowTime?: number, scheduler?: SchedulerLike): MonoTypeOperatorFunction<T>;
9export function publishReplay<T, O extends ObservableInput<any>>(bufferSize?: number, windowTime?: number, selector?: (shared: Observable<T>) => O, scheduler?: SchedulerLike): OperatorFunction<T, ObservedValueOf<O>>;
10/* tslint:enable:max-line-length */
11
12export function publishReplay<T, R>(bufferSize?: number,
13 windowTime?: number,
14 selectorOrScheduler?: SchedulerLike | OperatorFunction<T, R>,
15 scheduler?: SchedulerLike): UnaryFunction<Observable<T>, ConnectableObservable<R>> {
16
17 if (selectorOrScheduler && typeof selectorOrScheduler !== 'function') {
18 scheduler = selectorOrScheduler;
19 }
20
21 const selector = typeof selectorOrScheduler === 'function' ? selectorOrScheduler : undefined;
22 const subject = new ReplaySubject<T>(bufferSize, windowTime, scheduler);
23
24 return (source: Observable<T>) => multicast(() => subject, selector)(source) as ConnectableObservable<R>;
25}
Note: See TracBrowser for help on using the repository browser.