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

Commit 202a617

Browse files
Fixing Issue #964 and closing Issue #965
1 parent d655207 commit 202a617

25 files changed

Lines changed: 208 additions & 172 deletions

dist/rx.all.compat.js

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4472,27 +4472,30 @@ var ObserveOnObservable = (function (__super__) {
44724472
var WithLatestFromObservable = (function(__super__) {
44734473
inherits(WithLatestFromObservable, __super__);
44744474
function WithLatestFromObservable(source, sources, resultSelector) {
4475-
var len = sources.length;
44764475
this._s = source;
44774476
this._ss = sources;
44784477
this._cb = resultSelector;
4479-
this._hv = arrayInitialize(len, falseFactory);
4480-
this._hvAll = false;
4481-
this._v = new Array(len);
44824478
__super__.call(this);
44834479
}
44844480

44854481
WithLatestFromObservable.prototype.subscribeCore = function (o) {
4482+
var len = this._ss.length;
4483+
var state = {
4484+
hasValue: arrayInitialize(len, falseFactory),
4485+
hasValueAll: false,
4486+
values: new Array(len)
4487+
};
4488+
44864489
var n = this._ss.length, subscriptions = new Array(n + 1);
44874490
for (var i = 0; i < n; i++) {
44884491
var other = this._ss[i], sad = new SingleAssignmentDisposable();
44894492
isPromise(other) && (other = observableFromPromise(other));
4490-
sad.setDisposable(other.subscribe(new WithLatestFromOtherObserver(o, i, this)));
4493+
sad.setDisposable(other.subscribe(new WithLatestFromOtherObserver(o, i, state)));
44914494
subscriptions[i] = sad;
44924495
}
44934496

44944497
var sad = new SingleAssignmentDisposable();
4495-
sad.setDisposable(this._s.subscribe(new WithLatestFromSourceObserver(o, this)));
4498+
sad.setDisposable(this._s.subscribe(new WithLatestFromSourceObserver(o, this._cb, state)));
44964499
subscriptions[n] = sad;
44974500

44984501
return new NAryDisposable(subscriptions);
@@ -4503,17 +4506,17 @@ var ObserveOnObservable = (function (__super__) {
45034506

45044507
var WithLatestFromOtherObserver = (function (__super__) {
45054508
inherits(WithLatestFromOtherObserver, __super__);
4506-
function WithLatestFromOtherObserver(o, i, p) {
4509+
function WithLatestFromOtherObserver(o, i, state) {
45074510
this._o = o;
45084511
this._i = i;
4509-
this._p = p;
4512+
this._state = state;
45104513
__super__.call(this);
45114514
}
45124515

45134516
WithLatestFromOtherObserver.prototype.next = function (x) {
4514-
this._p._v[this._i] = x;
4515-
this._p._hv[this._i] = true;
4516-
this._p._hvAll = this._p._hv.every(identity);
4517+
this._state.values[this._i] = x;
4518+
this._state.hasValue[this._i] = true;
4519+
this._state.hasValueAll = this._state.hasValue.every(identity);
45174520
};
45184521

45194522
WithLatestFromOtherObserver.prototype.error = function (e) {
@@ -4527,16 +4530,17 @@ var ObserveOnObservable = (function (__super__) {
45274530

45284531
var WithLatestFromSourceObserver = (function (__super__) {
45294532
inherits(WithLatestFromSourceObserver, __super__);
4530-
function WithLatestFromSourceObserver(o, p) {
4533+
function WithLatestFromSourceObserver(o, cb, state) {
45314534
this._o = o;
4532-
this._p = p;
4535+
this._cb = cb;
4536+
this._state = state;
45334537
__super__.call(this);
45344538
}
45354539

45364540
WithLatestFromSourceObserver.prototype.next = function (x) {
4537-
var allValues = [x].concat(this._p._v);
4538-
if (!this._p._hvAll) { return; }
4539-
var res = tryCatch(this._p._cb).apply(null, allValues);
4541+
var allValues = [x].concat(this._state.values);
4542+
if (!this._state.hasValueAll) { return; }
4543+
var res = tryCatch(this._cb).apply(null, allValues);
45404544
if (res === errorObj) { return this._o.onError(res.e); }
45414545
this._o.onNext(res);
45424546
};

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: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4150,27 +4150,30 @@ var ObserveOnObservable = (function (__super__) {
41504150
var WithLatestFromObservable = (function(__super__) {
41514151
inherits(WithLatestFromObservable, __super__);
41524152
function WithLatestFromObservable(source, sources, resultSelector) {
4153-
var len = sources.length;
41544153
this._s = source;
41554154
this._ss = sources;
41564155
this._cb = resultSelector;
4157-
this._hv = arrayInitialize(len, falseFactory);
4158-
this._hvAll = false;
4159-
this._v = new Array(len);
41604156
__super__.call(this);
41614157
}
41624158

41634159
WithLatestFromObservable.prototype.subscribeCore = function (o) {
4160+
var len = this._ss.length;
4161+
var state = {
4162+
hasValue: arrayInitialize(len, falseFactory),
4163+
hasValueAll: false,
4164+
values: new Array(len)
4165+
};
4166+
41644167
var n = this._ss.length, subscriptions = new Array(n + 1);
41654168
for (var i = 0; i < n; i++) {
41664169
var other = this._ss[i], sad = new SingleAssignmentDisposable();
41674170
isPromise(other) && (other = observableFromPromise(other));
4168-
sad.setDisposable(other.subscribe(new WithLatestFromOtherObserver(o, i, this)));
4171+
sad.setDisposable(other.subscribe(new WithLatestFromOtherObserver(o, i, state)));
41694172
subscriptions[i] = sad;
41704173
}
41714174

41724175
var sad = new SingleAssignmentDisposable();
4173-
sad.setDisposable(this._s.subscribe(new WithLatestFromSourceObserver(o, this)));
4176+
sad.setDisposable(this._s.subscribe(new WithLatestFromSourceObserver(o, this._cb, state)));
41744177
subscriptions[n] = sad;
41754178

41764179
return new NAryDisposable(subscriptions);
@@ -4181,17 +4184,17 @@ var ObserveOnObservable = (function (__super__) {
41814184

41824185
var WithLatestFromOtherObserver = (function (__super__) {
41834186
inherits(WithLatestFromOtherObserver, __super__);
4184-
function WithLatestFromOtherObserver(o, i, p) {
4187+
function WithLatestFromOtherObserver(o, i, state) {
41854188
this._o = o;
41864189
this._i = i;
4187-
this._p = p;
4190+
this._state = state;
41884191
__super__.call(this);
41894192
}
41904193

41914194
WithLatestFromOtherObserver.prototype.next = function (x) {
4192-
this._p._v[this._i] = x;
4193-
this._p._hv[this._i] = true;
4194-
this._p._hvAll = this._p._hv.every(identity);
4195+
this._state.values[this._i] = x;
4196+
this._state.hasValue[this._i] = true;
4197+
this._state.hasValueAll = this._state.hasValue.every(identity);
41954198
};
41964199

41974200
WithLatestFromOtherObserver.prototype.error = function (e) {
@@ -4205,16 +4208,17 @@ var ObserveOnObservable = (function (__super__) {
42054208

42064209
var WithLatestFromSourceObserver = (function (__super__) {
42074210
inherits(WithLatestFromSourceObserver, __super__);
4208-
function WithLatestFromSourceObserver(o, p) {
4211+
function WithLatestFromSourceObserver(o, cb, state) {
42094212
this._o = o;
4210-
this._p = p;
4213+
this._cb = cb;
4214+
this._state = state;
42114215
__super__.call(this);
42124216
}
42134217

42144218
WithLatestFromSourceObserver.prototype.next = function (x) {
4215-
var allValues = [x].concat(this._p._v);
4216-
if (!this._p._hvAll) { return; }
4217-
var res = tryCatch(this._p._cb).apply(null, allValues);
4219+
var allValues = [x].concat(this._state.values);
4220+
if (!this._state.hasValueAll) { return; }
4221+
var res = tryCatch(this._cb).apply(null, allValues);
42184222
if (res === errorObj) { return this._o.onError(res.e); }
42194223
this._o.onNext(res);
42204224
};

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: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4472,27 +4472,30 @@ var ObserveOnObservable = (function (__super__) {
44724472
var WithLatestFromObservable = (function(__super__) {
44734473
inherits(WithLatestFromObservable, __super__);
44744474
function WithLatestFromObservable(source, sources, resultSelector) {
4475-
var len = sources.length;
44764475
this._s = source;
44774476
this._ss = sources;
44784477
this._cb = resultSelector;
4479-
this._hv = arrayInitialize(len, falseFactory);
4480-
this._hvAll = false;
4481-
this._v = new Array(len);
44824478
__super__.call(this);
44834479
}
44844480

44854481
WithLatestFromObservable.prototype.subscribeCore = function (o) {
4482+
var len = this._ss.length;
4483+
var state = {
4484+
hasValue: arrayInitialize(len, falseFactory),
4485+
hasValueAll: false,
4486+
values: new Array(len)
4487+
};
4488+
44864489
var n = this._ss.length, subscriptions = new Array(n + 1);
44874490
for (var i = 0; i < n; i++) {
44884491
var other = this._ss[i], sad = new SingleAssignmentDisposable();
44894492
isPromise(other) && (other = observableFromPromise(other));
4490-
sad.setDisposable(other.subscribe(new WithLatestFromOtherObserver(o, i, this)));
4493+
sad.setDisposable(other.subscribe(new WithLatestFromOtherObserver(o, i, state)));
44914494
subscriptions[i] = sad;
44924495
}
44934496

44944497
var sad = new SingleAssignmentDisposable();
4495-
sad.setDisposable(this._s.subscribe(new WithLatestFromSourceObserver(o, this)));
4498+
sad.setDisposable(this._s.subscribe(new WithLatestFromSourceObserver(o, this._cb, state)));
44964499
subscriptions[n] = sad;
44974500

44984501
return new NAryDisposable(subscriptions);
@@ -4503,17 +4506,17 @@ var ObserveOnObservable = (function (__super__) {
45034506

45044507
var WithLatestFromOtherObserver = (function (__super__) {
45054508
inherits(WithLatestFromOtherObserver, __super__);
4506-
function WithLatestFromOtherObserver(o, i, p) {
4509+
function WithLatestFromOtherObserver(o, i, state) {
45074510
this._o = o;
45084511
this._i = i;
4509-
this._p = p;
4512+
this._state = state;
45104513
__super__.call(this);
45114514
}
45124515

45134516
WithLatestFromOtherObserver.prototype.next = function (x) {
4514-
this._p._v[this._i] = x;
4515-
this._p._hv[this._i] = true;
4516-
this._p._hvAll = this._p._hv.every(identity);
4517+
this._state.values[this._i] = x;
4518+
this._state.hasValue[this._i] = true;
4519+
this._state.hasValueAll = this._state.hasValue.every(identity);
45174520
};
45184521

45194522
WithLatestFromOtherObserver.prototype.error = function (e) {
@@ -4527,16 +4530,17 @@ var ObserveOnObservable = (function (__super__) {
45274530

45284531
var WithLatestFromSourceObserver = (function (__super__) {
45294532
inherits(WithLatestFromSourceObserver, __super__);
4530-
function WithLatestFromSourceObserver(o, p) {
4533+
function WithLatestFromSourceObserver(o, cb, state) {
45314534
this._o = o;
4532-
this._p = p;
4535+
this._cb = cb;
4536+
this._state = state;
45334537
__super__.call(this);
45344538
}
45354539

45364540
WithLatestFromSourceObserver.prototype.next = function (x) {
4537-
var allValues = [x].concat(this._p._v);
4538-
if (!this._p._hvAll) { return; }
4539-
var res = tryCatch(this._p._cb).apply(null, allValues);
4541+
var allValues = [x].concat(this._state.values);
4542+
if (!this._state.hasValueAll) { return; }
4543+
var res = tryCatch(this._cb).apply(null, allValues);
45404544
if (res === errorObj) { return this._o.onError(res.e); }
45414545
this._o.onNext(res);
45424546
};

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: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4104,27 +4104,30 @@ var ObserveOnObservable = (function (__super__) {
41044104
var WithLatestFromObservable = (function(__super__) {
41054105
inherits(WithLatestFromObservable, __super__);
41064106
function WithLatestFromObservable(source, sources, resultSelector) {
4107-
var len = sources.length;
41084107
this._s = source;
41094108
this._ss = sources;
41104109
this._cb = resultSelector;
4111-
this._hv = arrayInitialize(len, falseFactory);
4112-
this._hvAll = false;
4113-
this._v = new Array(len);
41144110
__super__.call(this);
41154111
}
41164112

41174113
WithLatestFromObservable.prototype.subscribeCore = function (o) {
4114+
var len = this._ss.length;
4115+
var state = {
4116+
hasValue: arrayInitialize(len, falseFactory),
4117+
hasValueAll: false,
4118+
values: new Array(len)
4119+
};
4120+
41184121
var n = this._ss.length, subscriptions = new Array(n + 1);
41194122
for (var i = 0; i < n; i++) {
41204123
var other = this._ss[i], sad = new SingleAssignmentDisposable();
41214124
isPromise(other) && (other = observableFromPromise(other));
4122-
sad.setDisposable(other.subscribe(new WithLatestFromOtherObserver(o, i, this)));
4125+
sad.setDisposable(other.subscribe(new WithLatestFromOtherObserver(o, i, state)));
41234126
subscriptions[i] = sad;
41244127
}
41254128

41264129
var sad = new SingleAssignmentDisposable();
4127-
sad.setDisposable(this._s.subscribe(new WithLatestFromSourceObserver(o, this)));
4130+
sad.setDisposable(this._s.subscribe(new WithLatestFromSourceObserver(o, this._cb, state)));
41284131
subscriptions[n] = sad;
41294132

41304133
return new NAryDisposable(subscriptions);
@@ -4135,17 +4138,17 @@ var ObserveOnObservable = (function (__super__) {
41354138

41364139
var WithLatestFromOtherObserver = (function (__super__) {
41374140
inherits(WithLatestFromOtherObserver, __super__);
4138-
function WithLatestFromOtherObserver(o, i, p) {
4141+
function WithLatestFromOtherObserver(o, i, state) {
41394142
this._o = o;
41404143
this._i = i;
4141-
this._p = p;
4144+
this._state = state;
41424145
__super__.call(this);
41434146
}
41444147

41454148
WithLatestFromOtherObserver.prototype.next = function (x) {
4146-
this._p._v[this._i] = x;
4147-
this._p._hv[this._i] = true;
4148-
this._p._hvAll = this._p._hv.every(identity);
4149+
this._state.values[this._i] = x;
4150+
this._state.hasValue[this._i] = true;
4151+
this._state.hasValueAll = this._state.hasValue.every(identity);
41494152
};
41504153

41514154
WithLatestFromOtherObserver.prototype.error = function (e) {
@@ -4159,16 +4162,17 @@ var ObserveOnObservable = (function (__super__) {
41594162

41604163
var WithLatestFromSourceObserver = (function (__super__) {
41614164
inherits(WithLatestFromSourceObserver, __super__);
4162-
function WithLatestFromSourceObserver(o, p) {
4165+
function WithLatestFromSourceObserver(o, cb, state) {
41634166
this._o = o;
4164-
this._p = p;
4167+
this._cb = cb;
4168+
this._state = state;
41654169
__super__.call(this);
41664170
}
41674171

41684172
WithLatestFromSourceObserver.prototype.next = function (x) {
4169-
var allValues = [x].concat(this._p._v);
4170-
if (!this._p._hvAll) { return; }
4171-
var res = tryCatch(this._p._cb).apply(null, allValues);
4173+
var allValues = [x].concat(this._state.values);
4174+
if (!this._state.hasValueAll) { return; }
4175+
var res = tryCatch(this._cb).apply(null, allValues);
41724176
if (res === errorObj) { return this._o.onError(res.e); }
41734177
this._o.onNext(res);
41744178
};

0 commit comments

Comments
 (0)