Skip to content

Commit

Permalink
refactor(MergeMap): clarify any types which are used in MergeMapSubsc…
Browse files Browse the repository at this point in the history
…riber (#1748)

* refactor(mergeMap): make MergeMapSubscriber._notifyResultSelector() private

* refactor(MergeMap): make the type of MergeMapSubscriber.buffer correctly.

* refactor(MergeMap): clarify arguments' types of MergeMapSubscriber._innerSub()
  • Loading branch information
Tetsuharu OHZEKI authored and kwonoj committed Jun 7, 2016
1 parent fa77f28 commit 60bb00e
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/operator/mergeMap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ export class MergeMapOperator<T, I, R> implements Operator<T, I> {
*/
export class MergeMapSubscriber<T, I, R> extends OuterSubscriber<T, I> {
private hasCompleted: boolean = false;
private buffer: Observable<any>[] = [];
private buffer: T[] = [];
private active: number = 0;
protected index: number = 0;

Expand All @@ -103,16 +103,16 @@ export class MergeMapSubscriber<T, I, R> extends OuterSubscriber<T, I> {
super(destination);
}

protected _next(value: any): void {
protected _next(value: T): void {
if (this.active < this.concurrent) {
this._tryNext(value);
} else {
this.buffer.push(value);
}
}

protected _tryNext(value: any) {
let result: any;
protected _tryNext(value: T) {
let result: ObservableInput<I>;
const index = this.index++;
try {
result = this.project(value, index);
Expand All @@ -124,7 +124,7 @@ export class MergeMapSubscriber<T, I, R> extends OuterSubscriber<T, I> {
this._innerSub(result, value, index);
}

private _innerSub(ish: any, value: T, index: number): void {
private _innerSub(ish: ObservableInput<I>, value: T, index: number): void {
this.add(subscribeToResult<T, I>(this, ish, value, index));
}

Expand All @@ -145,7 +145,7 @@ export class MergeMapSubscriber<T, I, R> extends OuterSubscriber<T, I> {
}
}

_notifyResultSelector(outerValue: T, innerValue: I, outerIndex: number, innerIndex: number) {
private _notifyResultSelector(outerValue: T, innerValue: I, outerIndex: number, innerIndex: number) {
let result: R;
try {
result = this.resultSelector(outerValue, innerValue, outerIndex, innerIndex);
Expand Down

0 comments on commit 60bb00e

Please sign in to comment.