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

Commit c1486cc

Browse files
Version bump to 2.5.2
1 parent 296d9ef commit c1486cc

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+372
-318
lines changed

bower.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "rxjs",
3-
"version": "2.5.1",
3+
"version": "2.5.2",
44
"main": [
55
"dist/rx.all.js",
66
"dist/rx.all.map",

dist/rx.all.compat.js

+42-35
Original file line numberDiff line numberDiff line change
@@ -6694,15 +6694,14 @@
66946694
return this.source.subscribe(observer);
66956695
}
66966696

6697-
function ControlledObservable (source, enableQueue) {
6697+
function ControlledObservable (source, enableQueue, scheduler) {
66986698
__super__.call(this, subscribe, source);
6699-
this.subject = new ControlledSubject(enableQueue);
6699+
this.subject = new ControlledSubject(enableQueue, scheduler);
67006700
this.source = source.multicast(this.subject).refCount();
67016701
}
67026702

67036703
ControlledObservable.prototype.request = function (numberOfItems) {
6704-
if (numberOfItems == null) { numberOfItems = -1; }
6705-
return this.subject.request(numberOfItems);
6704+
return this.subject.request(numberOfItems == null ? -1 : numberOfItems);
67066705
};
67076706

67086707
return ControlledObservable;
@@ -6717,7 +6716,7 @@
67176716

67186717
inherits(ControlledSubject, __super__);
67196718

6720-
function ControlledSubject(enableQueue) {
6719+
function ControlledSubject(enableQueue, scheduler) {
67216720
enableQueue == null && (enableQueue = true);
67226721

67236722
__super__.call(this, subscribe);
@@ -6729,29 +6728,32 @@
67296728
this.error = null;
67306729
this.hasFailed = false;
67316730
this.hasCompleted = false;
6731+
this.scheduler = scheduler || currentThreadScheduler;
67326732
}
67336733

67346734
addProperties(ControlledSubject.prototype, Observer, {
67356735
onCompleted: function () {
67366736
this.hasCompleted = true;
6737-
if (!this.enableQueue || this.queue.length === 0)
6737+
if (!this.enableQueue || this.queue.length === 0) {
67386738
this.subject.onCompleted();
6739-
else
6740-
this.queue.push(Rx.Notification.createOnCompleted());
6739+
} else {
6740+
this.queue.push(Notification.createOnCompleted());
6741+
}
67416742
},
67426743
onError: function (error) {
67436744
this.hasFailed = true;
67446745
this.error = error;
6745-
if (!this.enableQueue || this.queue.length === 0)
6746+
if (!this.enableQueue || this.queue.length === 0) {
67466747
this.subject.onError(error);
6747-
else
6748-
this.queue.push(Rx.Notification.createOnError(error));
6748+
} else {
6749+
this.queue.push(Notification.createOnError(error));
6750+
}
67496751
},
67506752
onNext: function (value) {
67516753
var hasRequested = false;
67526754

67536755
if (this.requestedCount === 0) {
6754-
this.enableQueue && this.queue.push(Rx.Notification.createOnNext(value));
6756+
this.enableQueue && this.queue.push(Notification.createOnNext(value));
67556757
} else {
67566758
(this.requestedCount !== -1 && this.requestedCount-- === 0) && this.disposeCurrentRequest();
67576759
hasRequested = true;
@@ -6764,37 +6766,35 @@
67646766
(this.queue.length > 0 && this.queue[0].kind !== 'N')) {
67656767
var first = this.queue.shift();
67666768
first.accept(this.subject);
6767-
if (first.kind === 'N') numberOfItems--;
6768-
else { this.disposeCurrentRequest(); this.queue = []; }
6769+
if (first.kind === 'N') {
6770+
numberOfItems--;
6771+
} else {
6772+
this.disposeCurrentRequest();
6773+
this.queue = [];
6774+
}
67696775
}
67706776

67716777
return { numberOfItems : numberOfItems, returnValue: this.queue.length !== 0};
67726778
}
67736779

6774-
//TODO I don't think this is ever necessary, since termination of a sequence without a queue occurs in the onCompletion or onError function
6775-
//if (this.hasFailed) {
6776-
// this.subject.onError(this.error);
6777-
//} else if (this.hasCompleted) {
6778-
// this.subject.onCompleted();
6779-
//}
6780-
67816780
return { numberOfItems: numberOfItems, returnValue: false };
67826781
},
67836782
request: function (number) {
67846783
this.disposeCurrentRequest();
6785-
var self = this, r = this._processRequest(number);
6784+
var self = this;
67866785

6787-
var number = r.numberOfItems;
6788-
if (!r.returnValue) {
6789-
this.requestedCount = number;
6790-
this.requestedDisposable = disposableCreate(function () {
6791-
self.requestedCount = 0;
6792-
});
6786+
this.requestedDisposable = this.scheduler.scheduleWithState(number,
6787+
function(s, i) {
6788+
var r = self._processRequest(i), remaining = r.numberOfItems;
6789+
if (!r.returnValue) {
6790+
self.requestedCount = remaining;
6791+
self.requestedDisposable = disposableCreate(function () {
6792+
self.requestedCount = 0;
6793+
});
6794+
}
6795+
});
67936796

6794-
return this.requestedDisposable;
6795-
} else {
6796-
return disposableEmpty;
6797-
}
6797+
return this.requestedDisposable;
67986798
},
67996799
disposeCurrentRequest: function () {
68006800
this.requestedDisposable.dispose();
@@ -6810,12 +6810,19 @@
68106810
* @example
68116811
* var source = Rx.Observable.interval(100).controlled();
68126812
* source.request(3); // Reads 3 values
6813-
* @param {Observable} pauser The observable sequence used to pause the underlying sequence.
6813+
* @param {bool} enableQueue truthy value to determine if values should be queued pending the next request
6814+
* @param {Scheduler} scheduler determines how the requests will be scheduled
68146815
* @returns {Observable} The observable sequence which is paused based upon the pauser.
68156816
*/
6816-
observableProto.controlled = function (enableQueue) {
6817+
observableProto.controlled = function (enableQueue, scheduler) {
6818+
6819+
if (enableQueue && isScheduler(enableQueue)) {
6820+
scheduler = enableQueue;
6821+
enableQueue = true;
6822+
}
6823+
68176824
if (enableQueue == null) { enableQueue = true; }
6818-
return new ControlledObservable(this, enableQueue);
6825+
return new ControlledObservable(this, enableQueue, scheduler);
68196826
};
68206827

68216828
var StopAndWaitObservable = (function (__super__) {

dist/rx.all.compat.map

+1-1
Large diffs are not rendered by default.

dist/rx.all.compat.min.js

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/rx.all.js

+42-35
Original file line numberDiff line numberDiff line change
@@ -6481,15 +6481,14 @@
64816481
return this.source.subscribe(observer);
64826482
}
64836483

6484-
function ControlledObservable (source, enableQueue) {
6484+
function ControlledObservable (source, enableQueue, scheduler) {
64856485
__super__.call(this, subscribe, source);
6486-
this.subject = new ControlledSubject(enableQueue);
6486+
this.subject = new ControlledSubject(enableQueue, scheduler);
64876487
this.source = source.multicast(this.subject).refCount();
64886488
}
64896489

64906490
ControlledObservable.prototype.request = function (numberOfItems) {
6491-
if (numberOfItems == null) { numberOfItems = -1; }
6492-
return this.subject.request(numberOfItems);
6491+
return this.subject.request(numberOfItems == null ? -1 : numberOfItems);
64936492
};
64946493

64956494
return ControlledObservable;
@@ -6504,7 +6503,7 @@
65046503

65056504
inherits(ControlledSubject, __super__);
65066505

6507-
function ControlledSubject(enableQueue) {
6506+
function ControlledSubject(enableQueue, scheduler) {
65086507
enableQueue == null && (enableQueue = true);
65096508

65106509
__super__.call(this, subscribe);
@@ -6516,29 +6515,32 @@
65166515
this.error = null;
65176516
this.hasFailed = false;
65186517
this.hasCompleted = false;
6518+
this.scheduler = scheduler || currentThreadScheduler;
65196519
}
65206520

65216521
addProperties(ControlledSubject.prototype, Observer, {
65226522
onCompleted: function () {
65236523
this.hasCompleted = true;
6524-
if (!this.enableQueue || this.queue.length === 0)
6524+
if (!this.enableQueue || this.queue.length === 0) {
65256525
this.subject.onCompleted();
6526-
else
6527-
this.queue.push(Rx.Notification.createOnCompleted());
6526+
} else {
6527+
this.queue.push(Notification.createOnCompleted());
6528+
}
65286529
},
65296530
onError: function (error) {
65306531
this.hasFailed = true;
65316532
this.error = error;
6532-
if (!this.enableQueue || this.queue.length === 0)
6533+
if (!this.enableQueue || this.queue.length === 0) {
65336534
this.subject.onError(error);
6534-
else
6535-
this.queue.push(Rx.Notification.createOnError(error));
6535+
} else {
6536+
this.queue.push(Notification.createOnError(error));
6537+
}
65366538
},
65376539
onNext: function (value) {
65386540
var hasRequested = false;
65396541

65406542
if (this.requestedCount === 0) {
6541-
this.enableQueue && this.queue.push(Rx.Notification.createOnNext(value));
6543+
this.enableQueue && this.queue.push(Notification.createOnNext(value));
65426544
} else {
65436545
(this.requestedCount !== -1 && this.requestedCount-- === 0) && this.disposeCurrentRequest();
65446546
hasRequested = true;
@@ -6551,37 +6553,35 @@
65516553
(this.queue.length > 0 && this.queue[0].kind !== 'N')) {
65526554
var first = this.queue.shift();
65536555
first.accept(this.subject);
6554-
if (first.kind === 'N') numberOfItems--;
6555-
else { this.disposeCurrentRequest(); this.queue = []; }
6556+
if (first.kind === 'N') {
6557+
numberOfItems--;
6558+
} else {
6559+
this.disposeCurrentRequest();
6560+
this.queue = [];
6561+
}
65566562
}
65576563

65586564
return { numberOfItems : numberOfItems, returnValue: this.queue.length !== 0};
65596565
}
65606566

6561-
//TODO I don't think this is ever necessary, since termination of a sequence without a queue occurs in the onCompletion or onError function
6562-
//if (this.hasFailed) {
6563-
// this.subject.onError(this.error);
6564-
//} else if (this.hasCompleted) {
6565-
// this.subject.onCompleted();
6566-
//}
6567-
65686567
return { numberOfItems: numberOfItems, returnValue: false };
65696568
},
65706569
request: function (number) {
65716570
this.disposeCurrentRequest();
6572-
var self = this, r = this._processRequest(number);
6571+
var self = this;
65736572

6574-
var number = r.numberOfItems;
6575-
if (!r.returnValue) {
6576-
this.requestedCount = number;
6577-
this.requestedDisposable = disposableCreate(function () {
6578-
self.requestedCount = 0;
6579-
});
6573+
this.requestedDisposable = this.scheduler.scheduleWithState(number,
6574+
function(s, i) {
6575+
var r = self._processRequest(i), remaining = r.numberOfItems;
6576+
if (!r.returnValue) {
6577+
self.requestedCount = remaining;
6578+
self.requestedDisposable = disposableCreate(function () {
6579+
self.requestedCount = 0;
6580+
});
6581+
}
6582+
});
65806583

6581-
return this.requestedDisposable;
6582-
} else {
6583-
return disposableEmpty;
6584-
}
6584+
return this.requestedDisposable;
65856585
},
65866586
disposeCurrentRequest: function () {
65876587
this.requestedDisposable.dispose();
@@ -6597,12 +6597,19 @@
65976597
* @example
65986598
* var source = Rx.Observable.interval(100).controlled();
65996599
* source.request(3); // Reads 3 values
6600-
* @param {Observable} pauser The observable sequence used to pause the underlying sequence.
6600+
* @param {bool} enableQueue truthy value to determine if values should be queued pending the next request
6601+
* @param {Scheduler} scheduler determines how the requests will be scheduled
66016602
* @returns {Observable} The observable sequence which is paused based upon the pauser.
66026603
*/
6603-
observableProto.controlled = function (enableQueue) {
6604+
observableProto.controlled = function (enableQueue, scheduler) {
6605+
6606+
if (enableQueue && isScheduler(enableQueue)) {
6607+
scheduler = enableQueue;
6608+
enableQueue = true;
6609+
}
6610+
66046611
if (enableQueue == null) { enableQueue = true; }
6605-
return new ControlledObservable(this, enableQueue);
6612+
return new ControlledObservable(this, enableQueue, scheduler);
66066613
};
66076614

66086615
var StopAndWaitObservable = (function (__super__) {

dist/rx.all.map

+1-1
Large diffs are not rendered by default.

dist/rx.all.min.js

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)