Skip to content
This repository was archived by the owner on Apr 20, 2018. It is now read-only.

Commit d655207

Browse files
Fixing Issue #954
1 parent 031e887 commit d655207

25 files changed

Lines changed: 262 additions & 172 deletions

dist/rx.all.compat.js

Lines changed: 26 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3726,24 +3726,27 @@ var ObserveOnObservable = (function (__super__) {
37263726
var CombineLatestObservable = (function(__super__) {
37273727
inherits(CombineLatestObservable, __super__);
37283728
function CombineLatestObservable(params, cb) {
3729-
var len = params.length;
37303729
this._params = params;
37313730
this._cb = cb;
3732-
this._hv = arrayInitialize(len, falseFactory);
3733-
this._hvAll = false;
3734-
this._done = arrayInitialize(len, falseFactory);
3735-
this._v = new Array(len);
37363731
__super__.call(this);
37373732
}
37383733

37393734
CombineLatestObservable.prototype.subscribeCore = function(observer) {
3740-
var len = this._params.length, subscriptions = new Array(len);
3735+
var len = this._params.length,
3736+
subscriptions = new Array(len);
3737+
3738+
var state = {
3739+
hasValue: arrayInitialize(len, falseFactory),
3740+
hasValueAll: false,
3741+
isDone: arrayInitialize(len, falseFactory),
3742+
values: new Array(len)
3743+
};
37413744

37423745
for (var i = 0; i < len; i++) {
37433746
var source = this._params[i], sad = new SingleAssignmentDisposable();
37443747
subscriptions[i] = sad;
37453748
isPromise(source) && (source = observableFromPromise(source));
3746-
sad.setDisposable(source.subscribe(new CombineLatestObserver(observer, i, this)));
3749+
sad.setDisposable(source.subscribe(new CombineLatestObserver(observer, i, this._cb, state)));
37473750
}
37483751

37493752
return new NAryDisposable(subscriptions);
@@ -3754,21 +3757,28 @@ var ObserveOnObservable = (function (__super__) {
37543757

37553758
var CombineLatestObserver = (function (__super__) {
37563759
inherits(CombineLatestObserver, __super__);
3757-
function CombineLatestObserver(o, i, p) {
3760+
function CombineLatestObserver(o, i, cb, state) {
37583761
this._o = o;
37593762
this._i = i;
3760-
this._p = p;
3763+
this._cb = cb;
3764+
this._state = state;
37613765
__super__.call(this);
37623766
}
37633767

3768+
function notTheSame(i) {
3769+
return function (x, j) {
3770+
return j !== i;
3771+
};
3772+
}
3773+
37643774
CombineLatestObserver.prototype.next = function (x) {
3765-
this._p._v[this._i] = x;
3766-
this._p._hv[this._i] = true;
3767-
if (this._p._hvAll || (this._p._hvAll = this._p._hv.every(identity))) {
3768-
var res = tryCatch(this._p._cb).apply(null, this._p._v);
3775+
this._state.values[this._i] = x;
3776+
this._state.hasValue[this._i] = true;
3777+
if (this._state.hasValueAll || (this._state.hasValueAll = this._state.hasValue.every(identity))) {
3778+
var res = tryCatch(this._cb).apply(null, this._state.values);
37693779
if (res === errorObj) { return this._o.onError(res.e); }
37703780
this._o.onNext(res);
3771-
} else if (this._p._done.filter(function (x, j) { return j !== this._i; }, this).every(identity)) {
3781+
} else if (this._state.isDone.filter(notTheSame(this._i)).every(identity)) {
37723782
this._o.onCompleted();
37733783
}
37743784
};
@@ -3778,8 +3788,8 @@ var ObserveOnObservable = (function (__super__) {
37783788
};
37793789

37803790
CombineLatestObserver.prototype.completed = function () {
3781-
this._p._done[this._i] = true;
3782-
this._p._done.every(identity) && this._o.onCompleted();
3791+
this._state.isDone[this._i] = true;
3792+
this._state.isDone.every(identity) && this._o.onCompleted();
37833793
};
37843794

37853795
return CombineLatestObserver;

dist/rx.all.compat.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/rx.all.compat.min.js

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/rx.all.js

Lines changed: 26 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3404,24 +3404,27 @@ var ObserveOnObservable = (function (__super__) {
34043404
var CombineLatestObservable = (function(__super__) {
34053405
inherits(CombineLatestObservable, __super__);
34063406
function CombineLatestObservable(params, cb) {
3407-
var len = params.length;
34083407
this._params = params;
34093408
this._cb = cb;
3410-
this._hv = arrayInitialize(len, falseFactory);
3411-
this._hvAll = false;
3412-
this._done = arrayInitialize(len, falseFactory);
3413-
this._v = new Array(len);
34143409
__super__.call(this);
34153410
}
34163411

34173412
CombineLatestObservable.prototype.subscribeCore = function(observer) {
3418-
var len = this._params.length, subscriptions = new Array(len);
3413+
var len = this._params.length,
3414+
subscriptions = new Array(len);
3415+
3416+
var state = {
3417+
hasValue: arrayInitialize(len, falseFactory),
3418+
hasValueAll: false,
3419+
isDone: arrayInitialize(len, falseFactory),
3420+
values: new Array(len)
3421+
};
34193422

34203423
for (var i = 0; i < len; i++) {
34213424
var source = this._params[i], sad = new SingleAssignmentDisposable();
34223425
subscriptions[i] = sad;
34233426
isPromise(source) && (source = observableFromPromise(source));
3424-
sad.setDisposable(source.subscribe(new CombineLatestObserver(observer, i, this)));
3427+
sad.setDisposable(source.subscribe(new CombineLatestObserver(observer, i, this._cb, state)));
34253428
}
34263429

34273430
return new NAryDisposable(subscriptions);
@@ -3432,21 +3435,28 @@ var ObserveOnObservable = (function (__super__) {
34323435

34333436
var CombineLatestObserver = (function (__super__) {
34343437
inherits(CombineLatestObserver, __super__);
3435-
function CombineLatestObserver(o, i, p) {
3438+
function CombineLatestObserver(o, i, cb, state) {
34363439
this._o = o;
34373440
this._i = i;
3438-
this._p = p;
3441+
this._cb = cb;
3442+
this._state = state;
34393443
__super__.call(this);
34403444
}
34413445

3446+
function notTheSame(i) {
3447+
return function (x, j) {
3448+
return j !== i;
3449+
};
3450+
}
3451+
34423452
CombineLatestObserver.prototype.next = function (x) {
3443-
this._p._v[this._i] = x;
3444-
this._p._hv[this._i] = true;
3445-
if (this._p._hvAll || (this._p._hvAll = this._p._hv.every(identity))) {
3446-
var res = tryCatch(this._p._cb).apply(null, this._p._v);
3453+
this._state.values[this._i] = x;
3454+
this._state.hasValue[this._i] = true;
3455+
if (this._state.hasValueAll || (this._state.hasValueAll = this._state.hasValue.every(identity))) {
3456+
var res = tryCatch(this._cb).apply(null, this._state.values);
34473457
if (res === errorObj) { return this._o.onError(res.e); }
34483458
this._o.onNext(res);
3449-
} else if (this._p._done.filter(function (x, j) { return j !== this._i; }, this).every(identity)) {
3459+
} else if (this._state.isDone.filter(notTheSame(this._i)).every(identity)) {
34503460
this._o.onCompleted();
34513461
}
34523462
};
@@ -3456,8 +3466,8 @@ var ObserveOnObservable = (function (__super__) {
34563466
};
34573467

34583468
CombineLatestObserver.prototype.completed = function () {
3459-
this._p._done[this._i] = true;
3460-
this._p._done.every(identity) && this._o.onCompleted();
3469+
this._state.isDone[this._i] = true;
3470+
this._state.isDone.every(identity) && this._o.onCompleted();
34613471
};
34623472

34633473
return CombineLatestObserver;

dist/rx.all.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/rx.all.min.js

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/rx.compat.js

Lines changed: 26 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3726,24 +3726,27 @@ var ObserveOnObservable = (function (__super__) {
37263726
var CombineLatestObservable = (function(__super__) {
37273727
inherits(CombineLatestObservable, __super__);
37283728
function CombineLatestObservable(params, cb) {
3729-
var len = params.length;
37303729
this._params = params;
37313730
this._cb = cb;
3732-
this._hv = arrayInitialize(len, falseFactory);
3733-
this._hvAll = false;
3734-
this._done = arrayInitialize(len, falseFactory);
3735-
this._v = new Array(len);
37363731
__super__.call(this);
37373732
}
37383733

37393734
CombineLatestObservable.prototype.subscribeCore = function(observer) {
3740-
var len = this._params.length, subscriptions = new Array(len);
3735+
var len = this._params.length,
3736+
subscriptions = new Array(len);
3737+
3738+
var state = {
3739+
hasValue: arrayInitialize(len, falseFactory),
3740+
hasValueAll: false,
3741+
isDone: arrayInitialize(len, falseFactory),
3742+
values: new Array(len)
3743+
};
37413744

37423745
for (var i = 0; i < len; i++) {
37433746
var source = this._params[i], sad = new SingleAssignmentDisposable();
37443747
subscriptions[i] = sad;
37453748
isPromise(source) && (source = observableFromPromise(source));
3746-
sad.setDisposable(source.subscribe(new CombineLatestObserver(observer, i, this)));
3749+
sad.setDisposable(source.subscribe(new CombineLatestObserver(observer, i, this._cb, state)));
37473750
}
37483751

37493752
return new NAryDisposable(subscriptions);
@@ -3754,21 +3757,28 @@ var ObserveOnObservable = (function (__super__) {
37543757

37553758
var CombineLatestObserver = (function (__super__) {
37563759
inherits(CombineLatestObserver, __super__);
3757-
function CombineLatestObserver(o, i, p) {
3760+
function CombineLatestObserver(o, i, cb, state) {
37583761
this._o = o;
37593762
this._i = i;
3760-
this._p = p;
3763+
this._cb = cb;
3764+
this._state = state;
37613765
__super__.call(this);
37623766
}
37633767

3768+
function notTheSame(i) {
3769+
return function (x, j) {
3770+
return j !== i;
3771+
};
3772+
}
3773+
37643774
CombineLatestObserver.prototype.next = function (x) {
3765-
this._p._v[this._i] = x;
3766-
this._p._hv[this._i] = true;
3767-
if (this._p._hvAll || (this._p._hvAll = this._p._hv.every(identity))) {
3768-
var res = tryCatch(this._p._cb).apply(null, this._p._v);
3775+
this._state.values[this._i] = x;
3776+
this._state.hasValue[this._i] = true;
3777+
if (this._state.hasValueAll || (this._state.hasValueAll = this._state.hasValue.every(identity))) {
3778+
var res = tryCatch(this._cb).apply(null, this._state.values);
37693779
if (res === errorObj) { return this._o.onError(res.e); }
37703780
this._o.onNext(res);
3771-
} else if (this._p._done.filter(function (x, j) { return j !== this._i; }, this).every(identity)) {
3781+
} else if (this._state.isDone.filter(notTheSame(this._i)).every(identity)) {
37723782
this._o.onCompleted();
37733783
}
37743784
};
@@ -3778,8 +3788,8 @@ var ObserveOnObservable = (function (__super__) {
37783788
};
37793789

37803790
CombineLatestObserver.prototype.completed = function () {
3781-
this._p._done[this._i] = true;
3782-
this._p._done.every(identity) && this._o.onCompleted();
3791+
this._state.isDone[this._i] = true;
3792+
this._state.isDone.every(identity) && this._o.onCompleted();
37833793
};
37843794

37853795
return CombineLatestObserver;

dist/rx.compat.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/rx.compat.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/rx.js

Lines changed: 26 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3358,24 +3358,27 @@ var ObserveOnObservable = (function (__super__) {
33583358
var CombineLatestObservable = (function(__super__) {
33593359
inherits(CombineLatestObservable, __super__);
33603360
function CombineLatestObservable(params, cb) {
3361-
var len = params.length;
33623361
this._params = params;
33633362
this._cb = cb;
3364-
this._hv = arrayInitialize(len, falseFactory);
3365-
this._hvAll = false;
3366-
this._done = arrayInitialize(len, falseFactory);
3367-
this._v = new Array(len);
33683363
__super__.call(this);
33693364
}
33703365

33713366
CombineLatestObservable.prototype.subscribeCore = function(observer) {
3372-
var len = this._params.length, subscriptions = new Array(len);
3367+
var len = this._params.length,
3368+
subscriptions = new Array(len);
3369+
3370+
var state = {
3371+
hasValue: arrayInitialize(len, falseFactory),
3372+
hasValueAll: false,
3373+
isDone: arrayInitialize(len, falseFactory),
3374+
values: new Array(len)
3375+
};
33733376

33743377
for (var i = 0; i < len; i++) {
33753378
var source = this._params[i], sad = new SingleAssignmentDisposable();
33763379
subscriptions[i] = sad;
33773380
isPromise(source) && (source = observableFromPromise(source));
3378-
sad.setDisposable(source.subscribe(new CombineLatestObserver(observer, i, this)));
3381+
sad.setDisposable(source.subscribe(new CombineLatestObserver(observer, i, this._cb, state)));
33793382
}
33803383

33813384
return new NAryDisposable(subscriptions);
@@ -3386,21 +3389,28 @@ var ObserveOnObservable = (function (__super__) {
33863389

33873390
var CombineLatestObserver = (function (__super__) {
33883391
inherits(CombineLatestObserver, __super__);
3389-
function CombineLatestObserver(o, i, p) {
3392+
function CombineLatestObserver(o, i, cb, state) {
33903393
this._o = o;
33913394
this._i = i;
3392-
this._p = p;
3395+
this._cb = cb;
3396+
this._state = state;
33933397
__super__.call(this);
33943398
}
33953399

3400+
function notTheSame(i) {
3401+
return function (x, j) {
3402+
return j !== i;
3403+
};
3404+
}
3405+
33963406
CombineLatestObserver.prototype.next = function (x) {
3397-
this._p._v[this._i] = x;
3398-
this._p._hv[this._i] = true;
3399-
if (this._p._hvAll || (this._p._hvAll = this._p._hv.every(identity))) {
3400-
var res = tryCatch(this._p._cb).apply(null, this._p._v);
3407+
this._state.values[this._i] = x;
3408+
this._state.hasValue[this._i] = true;
3409+
if (this._state.hasValueAll || (this._state.hasValueAll = this._state.hasValue.every(identity))) {
3410+
var res = tryCatch(this._cb).apply(null, this._state.values);
34013411
if (res === errorObj) { return this._o.onError(res.e); }
34023412
this._o.onNext(res);
3403-
} else if (this._p._done.filter(function (x, j) { return j !== this._i; }, this).every(identity)) {
3413+
} else if (this._state.isDone.filter(notTheSame(this._i)).every(identity)) {
34043414
this._o.onCompleted();
34053415
}
34063416
};
@@ -3410,8 +3420,8 @@ var ObserveOnObservable = (function (__super__) {
34103420
};
34113421

34123422
CombineLatestObserver.prototype.completed = function () {
3413-
this._p._done[this._i] = true;
3414-
this._p._done.every(identity) && this._o.onCompleted();
3423+
this._state.isDone[this._i] = true;
3424+
this._state.isDone.every(identity) && this._o.onCompleted();
34153425
};
34163426

34173427
return CombineLatestObserver;

0 commit comments

Comments
 (0)