Skip to content

Commit 905abd0

Browse files
committed
feat(repeatWhen): added ObservableInput support for notifier
1 parent afac3d5 commit 905abd0

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

api_guard/dist/types/index.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -577,7 +577,7 @@ export declare function refCount<T>(): MonoTypeOperatorFunction<T>;
577577

578578
export declare function repeat<T>(countOrConfig?: number | RepeatConfig): MonoTypeOperatorFunction<T>;
579579

580-
export declare function repeatWhen<T>(notifier: (notifications: Observable<void>) => Observable<any>): MonoTypeOperatorFunction<T>;
580+
export declare function repeatWhen<T>(notifier: (notifications: Observable<void>) => ObservableInput<any>): MonoTypeOperatorFunction<T>;
581581

582582
export declare class ReplaySubject<T> extends Subject<T> {
583583
constructor(_bufferSize?: number, _windowTime?: number, _timestampProvider?: TimestampProvider);

api_guard/dist/types/operators/index.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ export declare function refCount<T>(): MonoTypeOperatorFunction<T>;
231231

232232
export declare function repeat<T>(countOrConfig?: number | RepeatConfig): MonoTypeOperatorFunction<T>;
233233

234-
export declare function repeatWhen<T>(notifier: (notifications: Observable<void>) => Observable<any>): MonoTypeOperatorFunction<T>;
234+
export declare function repeatWhen<T>(notifier: (notifications: Observable<void>) => ObservableInput<any>): MonoTypeOperatorFunction<T>;
235235

236236
export declare function retry<T>(count?: number): MonoTypeOperatorFunction<T>;
237237
export declare function retry<T>(config: RetryConfig): MonoTypeOperatorFunction<T>;

src/internal/operators/repeatWhen.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import { Observable } from '../Observable';
2+
import { innerFrom } from '../observable/innerFrom';
23
import { Subject } from '../Subject';
34
import { Subscription } from '../Subscription';
45

5-
import { MonoTypeOperatorFunction } from '../types';
6+
import { MonoTypeOperatorFunction, ObservableInput } from '../types';
67
import { operate } from '../util/lift';
78
import { createOperatorSubscriber } from './OperatorSubscriber';
89

@@ -33,13 +34,13 @@ import { createOperatorSubscriber } from './OperatorSubscriber';
3334
* @see {@link retry}
3435
* @see {@link retryWhen}
3536
*
36-
* @param {function(notifications: Observable): Observable} notifier - Receives an Observable of notifications with
37+
* @param notifier function that receives an Observable of notifications with
3738
* which a user can `complete` or `error`, aborting the repetition.
38-
* @return A function that returns an Observable that mirrors the source
39+
* @return A function that returns an `ObservableInput` that mirrors the source
3940
* Observable with the exception of a `complete`.
4041
* @deprecated Will be removed in v9 or v10. Use {@link repeat}'s `delay` option instead.
4142
*/
42-
export function repeatWhen<T>(notifier: (notifications: Observable<void>) => Observable<any>): MonoTypeOperatorFunction<T> {
43+
export function repeatWhen<T>(notifier: (notifications: Observable<void>) => ObservableInput<any>): MonoTypeOperatorFunction<T> {
4344
return operate((source, subscriber) => {
4445
let innerSub: Subscription | null;
4546
let syncResub = false;
@@ -61,7 +62,7 @@ export function repeatWhen<T>(notifier: (notifications: Observable<void>) => Obs
6162

6263
// If the call to `notifier` throws, it will be caught by the OperatorSubscriber
6364
// In the main subscription -- in `subscribeForRepeatWhen`.
64-
notifier(completions$).subscribe(
65+
innerFrom(notifier(completions$)).subscribe(
6566
createOperatorSubscriber(
6667
subscriber,
6768
() => {

0 commit comments

Comments
 (0)