-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(shareReplay): add compat signature
- Loading branch information
Showing
2 changed files
with
9 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters