Skip to content

Commit

Permalink
chore(shareReplay): add compat signature
Browse files Browse the repository at this point in the history
  • Loading branch information
cartant committed Aug 29, 2018
1 parent 1b07e13 commit e73baa2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
10 changes: 8 additions & 2 deletions compat/operator/shareReplay.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
import { Observable, SchedulerLike } from 'rxjs';
import { shareReplay as higherOrder } from 'rxjs/operators';
import { ShareReplayConfig } from 'rxjs/internal-compatibility';

/**
* @method shareReplay
* @owner Observable
*/
export function shareReplay<T>(this: Observable<T>, bufferSize?: number, windowTime?: number, scheduler?: SchedulerLike):
export function shareReplay<T>(this: Observable<T>, config: ShareReplayConfig): Observable<T>;
export function shareReplay<T>(this: Observable<T>, bufferSize?: number, windowTime?: number, scheduler?: SchedulerLike): Observable<T>;
export function shareReplay<T>(this: Observable<T>, configOrBufferSize?: ShareReplayConfig | number, windowTime?: number, scheduler?: SchedulerLike):
Observable<T> {
return higherOrder(bufferSize, windowTime, scheduler)(this) as Observable<T>;
if (configOrBufferSize && typeof configOrBufferSize === 'object') {
return higherOrder(configOrBufferSize as ShareReplayConfig)(this) as Observable<T>;
}
return higherOrder(configOrBufferSize as number | undefined, windowTime, scheduler)(this) as Observable<T>;
}
1 change: 1 addition & 0 deletions src/internal-compatibility/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export { SubscribeOnObservable } from '../internal/observable/SubscribeOnObserva
export { Timestamp } from '../internal/operators/timestamp';
export { TimeInterval } from '../internal/operators/timeInterval';
export { GroupedObservable } from '../internal/operators/groupBy';
export { ShareReplayConfig } from '../internal/operators/shareReplay';
export { ThrottleConfig, defaultThrottleConfig } from '../internal/operators/throttle';

export { rxSubscriber } from '../internal/symbol/rxSubscriber';
Expand Down

0 comments on commit e73baa2

Please sign in to comment.