this._parentOrParents = null;
this._subscriptions = null;
if (unsubscribe) {
+ this._ctorUnsubscribe = true;
this._unsubscribe = unsubscribe;
}
}
if (this.closed) {
return;
}
- var _a = this, _parentOrParents = _a._parentOrParents, _unsubscribe = _a._unsubscribe, _subscriptions = _a._subscriptions;
+ var _a = this, _parentOrParents = _a._parentOrParents, _ctorUnsubscribe = _a._ctorUnsubscribe, _unsubscribe = _a._unsubscribe, _subscriptions = _a._subscriptions;
this.closed = true;
this._parentOrParents = null;
this._subscriptions = null;
}
}
if (isFunction(_unsubscribe)) {
+ if (_ctorUnsubscribe) {
+ this._unsubscribe = undefined;
+ }
try {
_unsubscribe.call(this);
}
return _this;
}
ReplaySubject.prototype.nextInfiniteTimeWindow = function (value) {
- var _events = this._events;
- _events.push(value);
- if (_events.length > this._bufferSize) {
- _events.shift();
+ if (!this.isStopped) {
+ var _events = this._events;
+ _events.push(value);
+ if (_events.length > this._bufferSize) {
+ _events.shift();
+ }
}
_super.prototype.next.call(this, value);
};
ReplaySubject.prototype.nextTimeWindow = function (value) {
- this._events.push(new ReplayEvent(this._getNow(), value));
- this._trimBufferThenGetEvents();
+ if (!this.isStopped) {
+ this._events.push(new ReplayEvent(this._getNow(), value));
+ this._trimBufferThenGetEvents();
+ }
_super.prototype.next.call(this, value);
};
ReplaySubject.prototype._subscribe = function (subscriber) {
for (var _i = 0; _i < arguments.length; _i++) {
observables[_i] = arguments[_i];
}
- var resultSelector = null;
- var scheduler = null;
+ var resultSelector = undefined;
+ var scheduler = undefined;
if (isScheduler(observables[observables.length - 1])) {
scheduler = observables.pop();
}
this.toRespond = len;
for (var i = 0; i < len; i++) {
var observable = observables[i];
- this.add(subscribeToResult(this, observable, observable, i));
+ this.add(subscribeToResult(this, observable, undefined, i));
}
}
};
this.destination.complete();
}
};
- CombineLatestSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) {
+ CombineLatestSubscriber.prototype.notifyNext = function (_outerValue, innerValue, outerIndex) {
var values = this.values;
var oldVal = values[outerIndex];
var toRespond = !this.toRespond
}
}
+ var SimpleInnerSubscriber = (function (_super) {
+ __extends(SimpleInnerSubscriber, _super);
+ function SimpleInnerSubscriber(parent) {
+ var _this = _super.call(this) || this;
+ _this.parent = parent;
+ return _this;
+ }
+ SimpleInnerSubscriber.prototype._next = function (value) {
+ this.parent.notifyNext(value);
+ };
+ SimpleInnerSubscriber.prototype._error = function (error) {
+ this.parent.notifyError(error);
+ this.unsubscribe();
+ };
+ SimpleInnerSubscriber.prototype._complete = function () {
+ this.parent.notifyComplete();
+ this.unsubscribe();
+ };
+ return SimpleInnerSubscriber;
+ }(Subscriber));
+ var ComplexInnerSubscriber = (function (_super) {
+ __extends(ComplexInnerSubscriber, _super);
+ function ComplexInnerSubscriber(parent, outerValue, outerIndex) {
+ var _this = _super.call(this) || this;
+ _this.parent = parent;
+ _this.outerValue = outerValue;
+ _this.outerIndex = outerIndex;
+ return _this;
+ }
+ ComplexInnerSubscriber.prototype._next = function (value) {
+ this.parent.notifyNext(this.outerValue, value, this.outerIndex, this);
+ };
+ ComplexInnerSubscriber.prototype._error = function (error) {
+ this.parent.notifyError(error);
+ this.unsubscribe();
+ };
+ ComplexInnerSubscriber.prototype._complete = function () {
+ this.parent.notifyComplete(this);
+ this.unsubscribe();
+ };
+ return ComplexInnerSubscriber;
+ }(Subscriber));
+ var SimpleOuterSubscriber = (function (_super) {
+ __extends(SimpleOuterSubscriber, _super);
+ function SimpleOuterSubscriber() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ SimpleOuterSubscriber.prototype.notifyNext = function (innerValue) {
+ this.destination.next(innerValue);
+ };
+ SimpleOuterSubscriber.prototype.notifyError = function (err) {
+ this.destination.error(err);
+ };
+ SimpleOuterSubscriber.prototype.notifyComplete = function () {
+ this.destination.complete();
+ };
+ return SimpleOuterSubscriber;
+ }(Subscriber));
+ var ComplexOuterSubscriber = (function (_super) {
+ __extends(ComplexOuterSubscriber, _super);
+ function ComplexOuterSubscriber() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ ComplexOuterSubscriber.prototype.notifyNext = function (_outerValue, innerValue, _outerIndex, _innerSub) {
+ this.destination.next(innerValue);
+ };
+ ComplexOuterSubscriber.prototype.notifyError = function (error) {
+ this.destination.error(error);
+ };
+ ComplexOuterSubscriber.prototype.notifyComplete = function (_innerSub) {
+ this.destination.complete();
+ };
+ return ComplexOuterSubscriber;
+ }(Subscriber));
+ function innerSubscribe(result, innerSubscriber) {
+ if (innerSubscriber.closed) {
+ return undefined;
+ }
+ if (result instanceof Observable) {
+ return result.subscribe(innerSubscriber);
+ }
+ return subscribeTo(result)(innerSubscriber);
+ }
+
function mergeMap(project, resultSelector, concurrent) {
if (concurrent === void 0) { concurrent = Number.POSITIVE_INFINITY; }
if (typeof resultSelector === 'function') {
return;
}
this.active++;
- this._innerSub(result, value, index);
+ this._innerSub(result);
};
- MergeMapSubscriber.prototype._innerSub = function (ish, value, index) {
- var innerSubscriber = new InnerSubscriber(this, value, index);
+ MergeMapSubscriber.prototype._innerSub = function (ish) {
+ var innerSubscriber = new SimpleInnerSubscriber(this);
var destination = this.destination;
destination.add(innerSubscriber);
- var innerSubscription = subscribeToResult(this, ish, undefined, undefined, innerSubscriber);
+ var innerSubscription = innerSubscribe(ish, innerSubscriber);
if (innerSubscription !== innerSubscriber) {
destination.add(innerSubscription);
}
}
this.unsubscribe();
};
- MergeMapSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) {
+ MergeMapSubscriber.prototype.notifyNext = function (innerValue) {
this.destination.next(innerValue);
};
- MergeMapSubscriber.prototype.notifyComplete = function (innerSub) {
+ MergeMapSubscriber.prototype.notifyComplete = function () {
var buffer = this.buffer;
- this.remove(innerSub);
this.active--;
if (buffer.length > 0) {
this._next(buffer.shift());
}
};
return MergeMapSubscriber;
- }(OuterSubscriber));
+ }(SimpleOuterSubscriber));
var flatMap = mergeMap;
function mergeAll(concurrent) {
else {
for (var i = 0; i < len && !this.hasFirst; i++) {
var observable = observables[i];
- var subscription = subscribeToResult(this, observable, observable, i);
+ var subscription = subscribeToResult(this, observable, undefined, i);
if (this.subscriptions) {
this.subscriptions.push(subscription);
}
this.observables = null;
}
};
- RaceSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) {
+ RaceSubscriber.prototype.notifyNext = function (_outerValue, innerValue, outerIndex) {
if (!this.hasFirst) {
this.hasFirst = true;
for (var i = 0; i < this.subscriptions.length; i++) {
function ZipSubscriber(destination, resultSelector, values) {
if (values === void 0) { values = Object.create(null); }
var _this = _super.call(this, destination) || this;
+ _this.resultSelector = resultSelector;
_this.iterators = [];
_this.active = 0;
- _this.resultSelector = (typeof resultSelector === 'function') ? resultSelector : null;
- _this.values = values;
+ _this.resultSelector = (typeof resultSelector === 'function') ? resultSelector : undefined;
return _this;
}
ZipSubscriber.prototype._next = function (value) {
var iterator$$1 = iterators[i];
if (iterator$$1.stillUnsubscribed) {
var destination = this.destination;
- destination.add(iterator$$1.subscribe(iterator$$1, i));
+ destination.add(iterator$$1.subscribe());
}
else {
this.active--;
};
StaticIterator.prototype.hasCompleted = function () {
var nextResult = this.nextResult;
- return nextResult && nextResult.done;
+ return Boolean(nextResult && nextResult.done);
};
return StaticIterator;
}());
this.destination.complete();
}
};
- ZipBufferIterator.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) {
+ ZipBufferIterator.prototype.notifyNext = function (innerValue) {
this.buffer.push(innerValue);
this.parent.checkIterators();
};
- ZipBufferIterator.prototype.subscribe = function (value, index) {
- return subscribeToResult(this, this.observable, this, index);
+ ZipBufferIterator.prototype.subscribe = function () {
+ return innerSubscribe(this.observable, new SimpleInnerSubscriber(this));
};
return ZipBufferIterator;
- }(OuterSubscriber));
+ }(SimpleOuterSubscriber));
function audit(durationSelector) {
return function auditOperatorFunction(source) {
catch (err) {
return this.destination.error(err);
}
- var innerSubscription = subscribeToResult(this, duration);
+ var innerSubscription = innerSubscribe(duration, new SimpleInnerSubscriber(this));
if (!innerSubscription || innerSubscription.closed) {
this.clearThrottle();
}
var _a = this, value = _a.value, hasValue = _a.hasValue, throttled = _a.throttled;
if (throttled) {
this.remove(throttled);
- this.throttled = null;
+ this.throttled = undefined;
throttled.unsubscribe();
}
if (hasValue) {
- this.value = null;
+ this.value = undefined;
this.hasValue = false;
this.destination.next(value);
}
};
- AuditSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex) {
+ AuditSubscriber.prototype.notifyNext = function () {
this.clearThrottle();
};
AuditSubscriber.prototype.notifyComplete = function () {
this.clearThrottle();
};
return AuditSubscriber;
- }(OuterSubscriber));
+ }(SimpleOuterSubscriber));
function auditTime(duration, scheduler) {
if (scheduler === void 0) { scheduler = async; }
function BufferSubscriber(destination, closingNotifier) {
var _this = _super.call(this, destination) || this;
_this.buffer = [];
- _this.add(subscribeToResult(_this, closingNotifier));
+ _this.add(innerSubscribe(closingNotifier, new SimpleInnerSubscriber(_this)));
return _this;
}
BufferSubscriber.prototype._next = function (value) {
this.buffer.push(value);
};
- BufferSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) {
+ BufferSubscriber.prototype.notifyNext = function () {
var buffer = this.buffer;
this.buffer = [];
this.destination.next(buffer);
};
return BufferSubscriber;
- }(OuterSubscriber));
+ }(SimpleOuterSubscriber));
function bufferCount(bufferSize, startBufferEvery) {
if (startBufferEvery === void 0) { startBufferEvery = null; }
__extends(BufferToggleSubscriber, _super);
function BufferToggleSubscriber(destination, openings, closingSelector) {
var _this = _super.call(this, destination) || this;
- _this.openings = openings;
_this.closingSelector = closingSelector;
_this.contexts = [];
_this.add(subscribeToResult(_this, openings));
this.contexts = null;
_super.prototype._complete.call(this);
};
- BufferToggleSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) {
+ BufferToggleSubscriber.prototype.notifyNext = function (outerValue, innerValue) {
outerValue ? this.closeBuffer(outerValue) : this.openBuffer(innerValue);
};
BufferToggleSubscriber.prototype.notifyComplete = function (innerSub) {
_super.prototype._complete.call(this);
};
BufferWhenSubscriber.prototype._unsubscribe = function () {
- this.buffer = null;
+ this.buffer = undefined;
this.subscribing = false;
};
- BufferWhenSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) {
+ BufferWhenSubscriber.prototype.notifyNext = function () {
this.openBuffer();
};
BufferWhenSubscriber.prototype.notifyComplete = function () {
this.closingSubscription = closingSubscription;
this.add(closingSubscription);
this.subscribing = true;
- closingSubscription.add(subscribeToResult(this, closingNotifier));
+ closingSubscription.add(innerSubscribe(closingNotifier, new SimpleInnerSubscriber(this)));
this.subscribing = false;
};
return BufferWhenSubscriber;
- }(OuterSubscriber));
+ }(SimpleOuterSubscriber));
function catchError(selector) {
return function catchErrorOperatorFunction(source) {
return;
}
this._unsubscribeAndRecycle();
- var innerSubscriber = new InnerSubscriber(this, undefined, undefined);
+ var innerSubscriber = new SimpleInnerSubscriber(this);
this.add(innerSubscriber);
- var innerSubscription = subscribeToResult(this, result, undefined, undefined, innerSubscriber);
+ var innerSubscription = innerSubscribe(result, innerSubscriber);
if (innerSubscription !== innerSubscriber) {
this.add(innerSubscription);
}
}
};
return CatchSubscriber;
- }(OuterSubscriber));
+ }(SimpleOuterSubscriber));
function combineAll(project) {
return function (source) { return source.lift(new CombineLatestOperator(project)); };
var _this = _super.call(this, destination) || this;
_this.durationSelector = durationSelector;
_this.hasValue = false;
- _this.durationSubscription = null;
return _this;
}
DebounceSubscriber.prototype._next = function (value) {
subscription.unsubscribe();
this.remove(subscription);
}
- subscription = subscribeToResult(this, duration);
+ subscription = innerSubscribe(duration, new SimpleInnerSubscriber(this));
if (subscription && !subscription.closed) {
this.add(this.durationSubscription = subscription);
}
};
- DebounceSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) {
+ DebounceSubscriber.prototype.notifyNext = function () {
this.emitValue();
};
DebounceSubscriber.prototype.notifyComplete = function () {
var value = this.value;
var subscription = this.durationSubscription;
if (subscription) {
- this.durationSubscription = null;
+ this.durationSubscription = undefined;
subscription.unsubscribe();
this.remove(subscription);
}
- this.value = null;
+ this.value = undefined;
this.hasValue = false;
_super.prototype._next.call(this, value);
}
};
return DebounceSubscriber;
- }(OuterSubscriber));
+ }(SimpleOuterSubscriber));
function debounceTime(dueTime, scheduler) {
if (scheduler === void 0) { scheduler = async; }
_this.index = 0;
return _this;
}
- DelayWhenSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) {
+ DelayWhenSubscriber.prototype.notifyNext = function (outerValue, _innerValue, _outerIndex, _innerIndex, innerSub) {
this.destination.next(outerValue);
this.removeSubscription(innerSub);
this.tryComplete();
_this.keySelector = keySelector;
_this.values = new Set();
if (flushes) {
- _this.add(subscribeToResult(_this, flushes));
+ _this.add(innerSubscribe(flushes, new SimpleInnerSubscriber(_this)));
}
return _this;
}
- DistinctSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) {
+ DistinctSubscriber.prototype.notifyNext = function () {
this.values.clear();
};
- DistinctSubscriber.prototype.notifyError = function (error, innerSub) {
+ DistinctSubscriber.prototype.notifyError = function (error) {
this._error(error);
};
DistinctSubscriber.prototype._next = function (value) {
}
};
return DistinctSubscriber;
- }(OuterSubscriber));
+ }(SimpleOuterSubscriber));
function distinctUntilChanged(compare, keySelector) {
return function (source) { return source.lift(new DistinctUntilChangedOperator(compare, keySelector)); };
SwitchFirstSubscriber.prototype._next = function (value) {
if (!this.hasSubscription) {
this.hasSubscription = true;
- this.add(subscribeToResult(this, value));
+ this.add(innerSubscribe(value, new SimpleInnerSubscriber(this)));
}
};
SwitchFirstSubscriber.prototype._complete = function () {
this.destination.complete();
}
};
- SwitchFirstSubscriber.prototype.notifyComplete = function (innerSub) {
- this.remove(innerSub);
+ SwitchFirstSubscriber.prototype.notifyComplete = function () {
this.hasSubscription = false;
if (this.hasCompleted) {
this.destination.complete();
}
};
return SwitchFirstSubscriber;
- }(OuterSubscriber));
+ }(SimpleOuterSubscriber));
function exhaustMap(project, resultSelector) {
if (resultSelector) {
return;
}
this.hasSubscription = true;
- this._innerSub(result, value, index);
+ this._innerSub(result);
};
- ExhaustMapSubscriber.prototype._innerSub = function (result, value, index) {
- var innerSubscriber = new InnerSubscriber(this, value, index);
+ ExhaustMapSubscriber.prototype._innerSub = function (result) {
+ var innerSubscriber = new SimpleInnerSubscriber(this);
var destination = this.destination;
destination.add(innerSubscriber);
- var innerSubscription = subscribeToResult(this, result, undefined, undefined, innerSubscriber);
+ var innerSubscription = innerSubscribe(result, innerSubscriber);
if (innerSubscription !== innerSubscriber) {
destination.add(innerSubscription);
}
}
this.unsubscribe();
};
- ExhaustMapSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) {
+ ExhaustMapSubscriber.prototype.notifyNext = function (innerValue) {
this.destination.next(innerValue);
};
ExhaustMapSubscriber.prototype.notifyError = function (err) {
this.destination.error(err);
};
- ExhaustMapSubscriber.prototype.notifyComplete = function (innerSub) {
- var destination = this.destination;
- destination.remove(innerSub);
+ ExhaustMapSubscriber.prototype.notifyComplete = function () {
this.hasSubscription = false;
if (this.hasCompleted) {
this.destination.complete();
}
};
return ExhaustMapSubscriber;
- }(OuterSubscriber));
+ }(SimpleOuterSubscriber));
function expand(project, concurrent, scheduler) {
if (concurrent === void 0) { concurrent = Number.POSITIVE_INFINITY; }
- if (scheduler === void 0) { scheduler = undefined; }
concurrent = (concurrent || 0) < 1 ? Number.POSITIVE_INFINITY : concurrent;
return function (source) { return source.lift(new ExpandOperator(project, concurrent, scheduler)); };
}
ExpandSubscriber.prototype.subscribeToProjection = function (result, value, index) {
this.active++;
var destination = this.destination;
- destination.add(subscribeToResult(this, result, value, index));
+ destination.add(innerSubscribe(result, new SimpleInnerSubscriber(this)));
};
ExpandSubscriber.prototype._complete = function () {
this.hasCompleted = true;
}
this.unsubscribe();
};
- ExpandSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) {
+ ExpandSubscriber.prototype.notifyNext = function (innerValue) {
this._next(innerValue);
};
- ExpandSubscriber.prototype.notifyComplete = function (innerSub) {
+ ExpandSubscriber.prototype.notifyComplete = function () {
var buffer = this.buffer;
- var destination = this.destination;
- destination.remove(innerSub);
this.active--;
if (buffer && buffer.length > 0) {
this._next(buffer.shift());
}
};
return ExpandSubscriber;
- }(OuterSubscriber));
+ }(SimpleOuterSubscriber));
function finalize(callback) {
return function (source) { return source.lift(new FinallyOperator(callback)); };
return destination.error(e);
}
this.active++;
- this._innerSub(ish, value, index);
+ this._innerSub(ish);
}
else {
this.buffer.push(value);
}
};
- MergeScanSubscriber.prototype._innerSub = function (ish, value, index) {
- var innerSubscriber = new InnerSubscriber(this, value, index);
+ MergeScanSubscriber.prototype._innerSub = function (ish) {
+ var innerSubscriber = new SimpleInnerSubscriber(this);
var destination = this.destination;
destination.add(innerSubscriber);
- var innerSubscription = subscribeToResult(this, ish, undefined, undefined, innerSubscriber);
+ var innerSubscription = innerSubscribe(ish, innerSubscriber);
if (innerSubscription !== innerSubscriber) {
destination.add(innerSubscription);
}
}
this.unsubscribe();
};
- MergeScanSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) {
+ MergeScanSubscriber.prototype.notifyNext = function (innerValue) {
var destination = this.destination;
this.acc = innerValue;
this.hasValue = true;
destination.next(innerValue);
};
- MergeScanSubscriber.prototype.notifyComplete = function (innerSub) {
+ MergeScanSubscriber.prototype.notifyComplete = function () {
var buffer = this.buffer;
- var destination = this.destination;
- destination.remove(innerSub);
this.active--;
if (buffer.length > 0) {
this._next(buffer.shift());
}
};
return MergeScanSubscriber;
- }(OuterSubscriber));
+ }(SimpleOuterSubscriber));
function min(comparer) {
var min = (typeof comparer === 'function')
_this.nextSources = nextSources;
return _this;
}
- OnErrorResumeNextSubscriber.prototype.notifyError = function (error, innerSub) {
+ OnErrorResumeNextSubscriber.prototype.notifyError = function () {
this.subscribeToNextSource();
};
- OnErrorResumeNextSubscriber.prototype.notifyComplete = function (innerSub) {
+ OnErrorResumeNextSubscriber.prototype.notifyComplete = function () {
this.subscribeToNextSource();
};
OnErrorResumeNextSubscriber.prototype._error = function (err) {
OnErrorResumeNextSubscriber.prototype.subscribeToNextSource = function () {
var next = this.nextSources.shift();
if (!!next) {
- var innerSubscriber = new InnerSubscriber(this, undefined, undefined);
+ var innerSubscriber = new SimpleInnerSubscriber(this);
var destination = this.destination;
destination.add(innerSubscriber);
- var innerSubscription = subscribeToResult(this, next, undefined, undefined, innerSubscriber);
+ var innerSubscription = innerSubscribe(next, innerSubscriber);
if (innerSubscription !== innerSubscriber) {
destination.add(innerSubscription);
}
}
};
return OnErrorResumeNextSubscriber;
- }(OuterSubscriber));
+ }(SimpleOuterSubscriber));
function pairwise() {
return function (source) { return source.lift(new PairwiseOperator()); };
_this.sourceIsBeingSubscribedTo = true;
return _this;
}
- RepeatWhenSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) {
+ RepeatWhenSubscriber.prototype.notifyNext = function () {
this.sourceIsBeingSubscribedTo = true;
this.source.subscribe(this);
};
- RepeatWhenSubscriber.prototype.notifyComplete = function (innerSub) {
+ RepeatWhenSubscriber.prototype.notifyComplete = function () {
if (this.sourceIsBeingSubscribedTo === false) {
return _super.prototype.complete.call(this);
}
return _super.prototype.complete.call(this);
}
this._unsubscribeAndRecycle();
- this.notifications.next();
+ this.notifications.next(undefined);
}
};
RepeatWhenSubscriber.prototype._unsubscribe = function () {
var _a = this, notifications = _a.notifications, retriesSubscription = _a.retriesSubscription;
if (notifications) {
notifications.unsubscribe();
- this.notifications = null;
+ this.notifications = undefined;
}
if (retriesSubscription) {
retriesSubscription.unsubscribe();
- this.retriesSubscription = null;
+ this.retriesSubscription = undefined;
}
- this.retries = null;
+ this.retries = undefined;
};
RepeatWhenSubscriber.prototype._unsubscribeAndRecycle = function () {
var _unsubscribe = this._unsubscribe;
return _super.prototype.complete.call(this);
}
this.retries = retries;
- this.retriesSubscription = subscribeToResult(this, retries);
+ this.retriesSubscription = innerSubscribe(retries, new SimpleInnerSubscriber(this));
};
return RepeatWhenSubscriber;
- }(OuterSubscriber));
+ }(SimpleOuterSubscriber));
function retry(count) {
if (count === void 0) { count = -1; }
catch (e) {
return _super.prototype.error.call(this, e);
}
- retriesSubscription = subscribeToResult(this, retries);
+ retriesSubscription = innerSubscribe(retries, new SimpleInnerSubscriber(this));
}
else {
- this.errors = null;
- this.retriesSubscription = null;
+ this.errors = undefined;
+ this.retriesSubscription = undefined;
}
this._unsubscribeAndRecycle();
this.errors = errors;
var _a = this, errors = _a.errors, retriesSubscription = _a.retriesSubscription;
if (errors) {
errors.unsubscribe();
- this.errors = null;
+ this.errors = undefined;
}
if (retriesSubscription) {
retriesSubscription.unsubscribe();
- this.retriesSubscription = null;
+ this.retriesSubscription = undefined;
}
- this.retries = null;
+ this.retries = undefined;
};
- RetryWhenSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) {
+ RetryWhenSubscriber.prototype.notifyNext = function () {
var _unsubscribe = this._unsubscribe;
this._unsubscribe = null;
this._unsubscribeAndRecycle();
this.source.subscribe(this);
};
return RetryWhenSubscriber;
- }(OuterSubscriber));
+ }(SimpleOuterSubscriber));
function sample(notifier) {
return function (source) { return source.lift(new SampleOperator(notifier)); };
SampleOperator.prototype.call = function (subscriber, source) {
var sampleSubscriber = new SampleSubscriber(subscriber);
var subscription = source.subscribe(sampleSubscriber);
- subscription.add(subscribeToResult(sampleSubscriber, this.notifier));
+ subscription.add(innerSubscribe(this.notifier, new SimpleInnerSubscriber(sampleSubscriber)));
return subscription;
};
return SampleOperator;
this.value = value;
this.hasValue = true;
};
- SampleSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) {
+ SampleSubscriber.prototype.notifyNext = function () {
this.emitValue();
};
SampleSubscriber.prototype.notifyComplete = function () {
}
};
return SampleSubscriber;
- }(OuterSubscriber));
+ }(SimpleOuterSubscriber));
function sampleTime(period, scheduler) {
if (scheduler === void 0) { scheduler = async; }
function SkipUntilSubscriber(destination, notifier) {
var _this = _super.call(this, destination) || this;
_this.hasValue = false;
- var innerSubscriber = new InnerSubscriber(_this, undefined, undefined);
+ var innerSubscriber = new SimpleInnerSubscriber(_this);
_this.add(innerSubscriber);
_this.innerSubscription = innerSubscriber;
- var innerSubscription = subscribeToResult(_this, notifier, undefined, undefined, innerSubscriber);
+ var innerSubscription = innerSubscribe(notifier, innerSubscriber);
if (innerSubscription !== innerSubscriber) {
_this.add(innerSubscription);
_this.innerSubscription = innerSubscription;
_super.prototype._next.call(this, value);
}
};
- SkipUntilSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) {
+ SkipUntilSubscriber.prototype.notifyNext = function () {
this.hasValue = true;
if (this.innerSubscription) {
this.innerSubscription.unsubscribe();
SkipUntilSubscriber.prototype.notifyComplete = function () {
};
return SkipUntilSubscriber;
- }(OuterSubscriber));
+ }(SimpleOuterSubscriber));
function skipWhile(predicate) {
return function (source) { return source.lift(new SkipWhileOperator(predicate)); };
this.destination.error(error);
return;
}
- this._innerSub(result, value, index);
+ this._innerSub(result);
};
- SwitchMapSubscriber.prototype._innerSub = function (result, value, index) {
+ SwitchMapSubscriber.prototype._innerSub = function (result) {
var innerSubscription = this.innerSubscription;
if (innerSubscription) {
innerSubscription.unsubscribe();
}
- var innerSubscriber = new InnerSubscriber(this, value, index);
+ var innerSubscriber = new SimpleInnerSubscriber(this);
var destination = this.destination;
destination.add(innerSubscriber);
- this.innerSubscription = subscribeToResult(this, result, undefined, undefined, innerSubscriber);
+ this.innerSubscription = innerSubscribe(result, innerSubscriber);
if (this.innerSubscription !== innerSubscriber) {
destination.add(this.innerSubscription);
}
this.unsubscribe();
};
SwitchMapSubscriber.prototype._unsubscribe = function () {
- this.innerSubscription = null;
+ this.innerSubscription = undefined;
};
- SwitchMapSubscriber.prototype.notifyComplete = function (innerSub) {
- var destination = this.destination;
- destination.remove(innerSub);
- this.innerSubscription = null;
+ SwitchMapSubscriber.prototype.notifyComplete = function () {
+ this.innerSubscription = undefined;
if (this.isStopped) {
_super.prototype._complete.call(this);
}
};
- SwitchMapSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) {
+ SwitchMapSubscriber.prototype.notifyNext = function (innerValue) {
this.destination.next(innerValue);
};
return SwitchMapSubscriber;
- }(OuterSubscriber));
+ }(SimpleOuterSubscriber));
function switchAll() {
return switchMap(identity);
}
TakeUntilOperator.prototype.call = function (subscriber, source) {
var takeUntilSubscriber = new TakeUntilSubscriber(subscriber);
- var notifierSubscription = subscribeToResult(takeUntilSubscriber, this.notifier);
+ var notifierSubscription = innerSubscribe(this.notifier, new SimpleInnerSubscriber(takeUntilSubscriber));
if (notifierSubscription && !takeUntilSubscriber.seenValue) {
takeUntilSubscriber.add(notifierSubscription);
return source.subscribe(takeUntilSubscriber);
_this.seenValue = false;
return _this;
}
- TakeUntilSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) {
+ TakeUntilSubscriber.prototype.notifyNext = function () {
this.seenValue = true;
this.complete();
};
TakeUntilSubscriber.prototype.notifyComplete = function () {
};
return TakeUntilSubscriber;
- }(OuterSubscriber));
+ }(SimpleOuterSubscriber));
function takeWhile(predicate, inclusive) {
if (inclusive === void 0) { inclusive = false; }
};
function throttle(durationSelector, config) {
if (config === void 0) { config = defaultThrottleConfig; }
- return function (source) { return source.lift(new ThrottleOperator(durationSelector, config.leading, config.trailing)); };
+ return function (source) { return source.lift(new ThrottleOperator(durationSelector, !!config.leading, !!config.trailing)); };
}
var ThrottleOperator = (function () {
function ThrottleOperator(durationSelector, leading, trailing) {
this.throttle(_sendValue);
}
this._hasValue = false;
- this._sendValue = null;
+ this._sendValue = undefined;
};
ThrottleSubscriber.prototype.throttle = function (value) {
var duration = this.tryDurationSelector(value);
if (!!duration) {
- this.add(this._throttled = subscribeToResult(this, duration));
+ this.add(this._throttled = innerSubscribe(duration, new SimpleInnerSubscriber(this)));
}
};
ThrottleSubscriber.prototype.tryDurationSelector = function (value) {
if (_throttled) {
_throttled.unsubscribe();
}
- this._throttled = null;
+ this._throttled = undefined;
if (_trailing) {
this.send();
}
};
- ThrottleSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) {
+ ThrottleSubscriber.prototype.notifyNext = function () {
this.throttlingDone();
};
ThrottleSubscriber.prototype.notifyComplete = function () {
this.throttlingDone();
};
return ThrottleSubscriber;
- }(OuterSubscriber));
+ }(SimpleOuterSubscriber));
function throttleTime(duration, scheduler, config) {
if (scheduler === void 0) { scheduler = async; }
_this.waitFor = waitFor;
_this.withObservable = withObservable;
_this.scheduler = scheduler;
- _this.action = null;
_this.scheduleTimeout();
return _this;
}
TimeoutWithSubscriber.dispatchTimeout = function (subscriber) {
var withObservable = subscriber.withObservable;
subscriber._unsubscribeAndRecycle();
- subscriber.add(subscribeToResult(subscriber, withObservable));
+ subscriber.add(innerSubscribe(withObservable, new SimpleInnerSubscriber(subscriber)));
};
TimeoutWithSubscriber.prototype.scheduleTimeout = function () {
var action = this.action;
_super.prototype._next.call(this, value);
};
TimeoutWithSubscriber.prototype._unsubscribe = function () {
- this.action = null;
+ this.action = undefined;
this.scheduler = null;
this.withObservable = null;
};
return TimeoutWithSubscriber;
- }(OuterSubscriber));
+ }(SimpleOuterSubscriber));
function timeout(due, scheduler) {
if (scheduler === void 0) { scheduler = async; }
var windowSubscriber = new WindowSubscriber(subscriber);
var sourceSubscription = source.subscribe(windowSubscriber);
if (!sourceSubscription.closed) {
- windowSubscriber.add(subscribeToResult(windowSubscriber, this.windowBoundaries));
+ windowSubscriber.add(innerSubscribe(this.windowBoundaries, new SimpleInnerSubscriber(windowSubscriber)));
}
return sourceSubscription;
};
destination.next(_this.window);
return _this;
}
- WindowSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) {
+ WindowSubscriber.prototype.notifyNext = function () {
this.openWindow();
};
- WindowSubscriber.prototype.notifyError = function (error, innerSub) {
+ WindowSubscriber.prototype.notifyError = function (error) {
this._error(error);
};
- WindowSubscriber.prototype.notifyComplete = function (innerSub) {
+ WindowSubscriber.prototype.notifyComplete = function () {
this._complete();
};
WindowSubscriber.prototype._next = function (value) {
destination.next(newWindow);
};
return WindowSubscriber;
- }(OuterSubscriber));
+ }(SimpleOuterSubscriber));
function windowCount(windowSize, startWindowEvery) {
if (startWindowEvery === void 0) { startWindowEvery = 0; }
_this.openWindow();
return _this;
}
- WindowSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) {
+ WindowSubscriber.prototype.notifyNext = function (_outerValue, _innerValue, _outerIndex, _innerIndex, innerSub) {
this.openWindow(innerSub);
};
- WindowSubscriber.prototype.notifyError = function (error, innerSub) {
+ WindowSubscriber.prototype.notifyError = function (error) {
this._error(error);
};
WindowSubscriber.prototype.notifyComplete = function (innerSub) {
}
for (var i = 0; i < len; i++) {
var observable = observables[i];
- _this.add(subscribeToResult(_this, observable, observable, i));
+ _this.add(subscribeToResult(_this, observable, undefined, i));
}
return _this;
}
- WithLatestFromSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) {
+ WithLatestFromSubscriber.prototype.notifyNext = function (_outerValue, innerValue, outerIndex) {
this.values[outerIndex] = innerValue;
var toRespond = this.toRespond;
if (toRespond.length > 0) {