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 3b4b01f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
11 changes: 9 additions & 2 deletions compat/operator/shareReplay.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
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>;
/** @deprecated Use config parameter */
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 3b4b01f

Please sign in to comment.