-import { OuterSubscriber } from '../OuterSubscriber';
-import { subscribeToResult } from '../util/subscribeToResult';
-export function expand(project, concurrent = Number.POSITIVE_INFINITY, scheduler = undefined) {
+import { SimpleOuterSubscriber, innerSubscribe, SimpleInnerSubscriber } from '../innerSubscribe';
+export function expand(project, concurrent = Number.POSITIVE_INFINITY, scheduler) {
concurrent = (concurrent || 0) < 1 ? Number.POSITIVE_INFINITY : concurrent;
return (source) => source.lift(new ExpandOperator(project, concurrent, scheduler));
}
return source.subscribe(new ExpandSubscriber(subscriber, this.project, this.concurrent, this.scheduler));
}
}
-export class ExpandSubscriber extends OuterSubscriber {
+export class ExpandSubscriber extends SimpleOuterSubscriber {
constructor(destination, project, concurrent, scheduler) {
super(destination);
this.project = project;
subscribeToProjection(result, value, index) {
this.active++;
const destination = this.destination;
- destination.add(subscribeToResult(this, result, value, index));
+ destination.add(innerSubscribe(result, new SimpleInnerSubscriber(this)));
}
_complete() {
this.hasCompleted = true;
}
this.unsubscribe();
}
- notifyNext(outerValue, innerValue, outerIndex, innerIndex, innerSub) {
+ notifyNext(innerValue) {
this._next(innerValue);
}
- notifyComplete(innerSub) {
+ notifyComplete() {
const buffer = this.buffer;
- const destination = this.destination;
- destination.remove(innerSub);
this.active--;
if (buffer && buffer.length > 0) {
this._next(buffer.shift());