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

Commit 8814268

Browse files
Updating readme
1 parent 6a3c247 commit 8814268

17 files changed

Lines changed: 205 additions & 113 deletions

dist/rx.all.compat.js

Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -6579,24 +6579,29 @@
65796579
this.error = null;
65806580
this.hasFailed = false;
65816581
this.hasCompleted = false;
6582-
this.controlledDisposable = disposableEmpty;
65836582
}
65846583

65856584
addProperties(ControlledSubject.prototype, Observer, {
65866585
onCompleted: function () {
65876586
this.hasCompleted = true;
6588-
(!this.enableQueue || this.queue.length === 0) && this.subject.onCompleted();
6587+
if (!this.enableQueue || this.queue.length === 0)
6588+
this.subject.onCompleted();
6589+
else
6590+
this.queue.push(Rx.Notification.createOnCompleted());
65896591
},
65906592
onError: function (error) {
65916593
this.hasFailed = true;
65926594
this.error = error;
6593-
(!this.enableQueue || this.queue.length === 0) && this.subject.onError(error);
6595+
if (!this.enableQueue || this.queue.length === 0)
6596+
this.subject.onError(error);
6597+
else
6598+
this.queue.push(Rx.Notification.createOnError(error));
65946599
},
65956600
onNext: function (value) {
65966601
var hasRequested = false;
65976602

65986603
if (this.requestedCount === 0) {
6599-
this.enableQueue && this.queue.push(value);
6604+
this.enableQueue && this.queue.push(Rx.Notification.createOnNext(value));
66006605
} else {
66016606
(this.requestedCount !== -1 && this.requestedCount-- === 0) && this.disposeCurrentRequest();
66026607
hasRequested = true;
@@ -6605,25 +6610,23 @@
66056610
},
66066611
_processRequest: function (numberOfItems) {
66076612
if (this.enableQueue) {
6608-
while (this.queue.length >= numberOfItems && numberOfItems > 0) {
6609-
this.subject.onNext(this.queue.shift());
6610-
numberOfItems--;
6613+
while ((this.queue.length >= numberOfItems && numberOfItems > 0) ||
6614+
(this.queue.length > 0 && this.queue[0].kind !== 'N')) {
6615+
var first = this.queue.shift();
6616+
first.accept(this.subject);
6617+
if (first.kind === 'N') numberOfItems--;
6618+
else { this.disposeCurrentRequest(); this.queue = []; }
66116619
}
66126620

6613-
return this.queue.length !== 0 ?
6614-
{ numberOfItems: numberOfItems, returnValue: true } :
6615-
{ numberOfItems: numberOfItems, returnValue: false };
6621+
return { numberOfItems : numberOfItems, returnValue: this.queue.length !== 0};
66166622
}
66176623

6618-
if (this.hasFailed) {
6619-
this.subject.onError(this.error);
6620-
this.controlledDisposable.dispose();
6621-
this.controlledDisposable = disposableEmpty;
6622-
} else if (this.hasCompleted) {
6623-
this.subject.onCompleted();
6624-
this.controlledDisposable.dispose();
6625-
this.controlledDisposable = disposableEmpty;
6626-
}
6624+
//TODO I don't think this is ever necessary, since termination of a sequence without a queue occurs in the onCompletion or onError function
6625+
//if (this.hasFailed) {
6626+
// this.subject.onError(this.error);
6627+
//} else if (this.hasCompleted) {
6628+
// this.subject.onCompleted();
6629+
//}
66276630

66286631
return { numberOfItems: numberOfItems, returnValue: false };
66296632
},
@@ -6638,7 +6641,7 @@
66386641
self.requestedCount = 0;
66396642
});
66406643

6641-
return this.requestedDisposable
6644+
return this.requestedDisposable;
66426645
} else {
66436646
return disposableEmpty;
66446647
}

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: 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.js

Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -6366,24 +6366,29 @@
63666366
this.error = null;
63676367
this.hasFailed = false;
63686368
this.hasCompleted = false;
6369-
this.controlledDisposable = disposableEmpty;
63706369
}
63716370

63726371
addProperties(ControlledSubject.prototype, Observer, {
63736372
onCompleted: function () {
63746373
this.hasCompleted = true;
6375-
(!this.enableQueue || this.queue.length === 0) && this.subject.onCompleted();
6374+
if (!this.enableQueue || this.queue.length === 0)
6375+
this.subject.onCompleted();
6376+
else
6377+
this.queue.push(Rx.Notification.createOnCompleted());
63766378
},
63776379
onError: function (error) {
63786380
this.hasFailed = true;
63796381
this.error = error;
6380-
(!this.enableQueue || this.queue.length === 0) && this.subject.onError(error);
6382+
if (!this.enableQueue || this.queue.length === 0)
6383+
this.subject.onError(error);
6384+
else
6385+
this.queue.push(Rx.Notification.createOnError(error));
63816386
},
63826387
onNext: function (value) {
63836388
var hasRequested = false;
63846389

63856390
if (this.requestedCount === 0) {
6386-
this.enableQueue && this.queue.push(value);
6391+
this.enableQueue && this.queue.push(Rx.Notification.createOnNext(value));
63876392
} else {
63886393
(this.requestedCount !== -1 && this.requestedCount-- === 0) && this.disposeCurrentRequest();
63896394
hasRequested = true;
@@ -6392,25 +6397,23 @@
63926397
},
63936398
_processRequest: function (numberOfItems) {
63946399
if (this.enableQueue) {
6395-
while (this.queue.length >= numberOfItems && numberOfItems > 0) {
6396-
this.subject.onNext(this.queue.shift());
6397-
numberOfItems--;
6400+
while ((this.queue.length >= numberOfItems && numberOfItems > 0) ||
6401+
(this.queue.length > 0 && this.queue[0].kind !== 'N')) {
6402+
var first = this.queue.shift();
6403+
first.accept(this.subject);
6404+
if (first.kind === 'N') numberOfItems--;
6405+
else { this.disposeCurrentRequest(); this.queue = []; }
63986406
}
63996407

6400-
return this.queue.length !== 0 ?
6401-
{ numberOfItems: numberOfItems, returnValue: true } :
6402-
{ numberOfItems: numberOfItems, returnValue: false };
6408+
return { numberOfItems : numberOfItems, returnValue: this.queue.length !== 0};
64036409
}
64046410

6405-
if (this.hasFailed) {
6406-
this.subject.onError(this.error);
6407-
this.controlledDisposable.dispose();
6408-
this.controlledDisposable = disposableEmpty;
6409-
} else if (this.hasCompleted) {
6410-
this.subject.onCompleted();
6411-
this.controlledDisposable.dispose();
6412-
this.controlledDisposable = disposableEmpty;
6413-
}
6411+
//TODO I don't think this is ever necessary, since termination of a sequence without a queue occurs in the onCompletion or onError function
6412+
//if (this.hasFailed) {
6413+
// this.subject.onError(this.error);
6414+
//} else if (this.hasCompleted) {
6415+
// this.subject.onCompleted();
6416+
//}
64146417

64156418
return { numberOfItems: numberOfItems, returnValue: false };
64166419
},
@@ -6425,7 +6428,7 @@
64256428
self.requestedCount = 0;
64266429
});
64276430

6428-
return this.requestedDisposable
6431+
return this.requestedDisposable;
64296432
} else {
64306433
return disposableEmpty;
64316434
}

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: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/rx.backpressure.js

Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -323,24 +323,29 @@
323323
this.error = null;
324324
this.hasFailed = false;
325325
this.hasCompleted = false;
326-
this.controlledDisposable = disposableEmpty;
327326
}
328327

329328
addProperties(ControlledSubject.prototype, Observer, {
330329
onCompleted: function () {
331330
this.hasCompleted = true;
332-
(!this.enableQueue || this.queue.length === 0) && this.subject.onCompleted();
331+
if (!this.enableQueue || this.queue.length === 0)
332+
this.subject.onCompleted();
333+
else
334+
this.queue.push(Rx.Notification.createOnCompleted());
333335
},
334336
onError: function (error) {
335337
this.hasFailed = true;
336338
this.error = error;
337-
(!this.enableQueue || this.queue.length === 0) && this.subject.onError(error);
339+
if (!this.enableQueue || this.queue.length === 0)
340+
this.subject.onError(error);
341+
else
342+
this.queue.push(Rx.Notification.createOnError(error));
338343
},
339344
onNext: function (value) {
340345
var hasRequested = false;
341346

342347
if (this.requestedCount === 0) {
343-
this.enableQueue && this.queue.push(value);
348+
this.enableQueue && this.queue.push(Rx.Notification.createOnNext(value));
344349
} else {
345350
(this.requestedCount !== -1 && this.requestedCount-- === 0) && this.disposeCurrentRequest();
346351
hasRequested = true;
@@ -349,25 +354,23 @@
349354
},
350355
_processRequest: function (numberOfItems) {
351356
if (this.enableQueue) {
352-
while (this.queue.length >= numberOfItems && numberOfItems > 0) {
353-
this.subject.onNext(this.queue.shift());
354-
numberOfItems--;
357+
while ((this.queue.length >= numberOfItems && numberOfItems > 0) ||
358+
(this.queue.length > 0 && this.queue[0].kind !== 'N')) {
359+
var first = this.queue.shift();
360+
first.accept(this.subject);
361+
if (first.kind === 'N') numberOfItems--;
362+
else { this.disposeCurrentRequest(); this.queue = []; }
355363
}
356364

357-
return this.queue.length !== 0 ?
358-
{ numberOfItems: numberOfItems, returnValue: true } :
359-
{ numberOfItems: numberOfItems, returnValue: false };
365+
return { numberOfItems : numberOfItems, returnValue: this.queue.length !== 0};
360366
}
361367

362-
if (this.hasFailed) {
363-
this.subject.onError(this.error);
364-
this.controlledDisposable.dispose();
365-
this.controlledDisposable = disposableEmpty;
366-
} else if (this.hasCompleted) {
367-
this.subject.onCompleted();
368-
this.controlledDisposable.dispose();
369-
this.controlledDisposable = disposableEmpty;
370-
}
368+
//TODO I don't think this is ever necessary, since termination of a sequence without a queue occurs in the onCompletion or onError function
369+
//if (this.hasFailed) {
370+
// this.subject.onError(this.error);
371+
//} else if (this.hasCompleted) {
372+
// this.subject.onCompleted();
373+
//}
371374

372375
return { numberOfItems: numberOfItems, returnValue: false };
373376
},
@@ -382,7 +385,7 @@
382385
self.requestedCount = 0;
383386
});
384387

385-
return this.requestedDisposable
388+
return this.requestedDisposable;
386389
} else {
387390
return disposableEmpty;
388391
}

dist/rx.backpressure.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.

0 commit comments

Comments
 (0)