rxjs-rails 2.2.17 → 2.2.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/Rakefile +19 -0
  4. data/lib/rxjs/rails/version.rb +1 -1
  5. data/vendor/assets/javascripts/rx.aggregates.js +23 -23
  6. data/vendor/assets/javascripts/rx.aggregates.min.js +1 -1
  7. data/vendor/assets/javascripts/rx.async.compat.js +2 -2
  8. data/vendor/assets/javascripts/rx.async.compat.min.js +1 -1
  9. data/vendor/assets/javascripts/rx.async.js +2 -2
  10. data/vendor/assets/javascripts/rx.async.min.js +1 -1
  11. data/vendor/assets/javascripts/rx.backpressure.js +2 -2
  12. data/vendor/assets/javascripts/rx.backpressure.min.js +1 -1
  13. data/vendor/assets/javascripts/rx.binding.js +85 -85
  14. data/vendor/assets/javascripts/rx.coincidence.js +17 -17
  15. data/vendor/assets/javascripts/rx.coincidence.min.js +1 -1
  16. data/vendor/assets/javascripts/rx.compat.js +461 -456
  17. data/vendor/assets/javascripts/rx.compat.min.js +2 -2
  18. data/vendor/assets/javascripts/rx.experimental.js +31 -31
  19. data/vendor/assets/javascripts/rx.experimental.min.js +1 -1
  20. data/vendor/assets/javascripts/rx.joinpatterns.js +284 -284
  21. data/vendor/assets/javascripts/rx.joinpatterns.min.js +1 -1
  22. data/vendor/assets/javascripts/rx.js +446 -441
  23. data/vendor/assets/javascripts/rx.lite.compat.js +469 -464
  24. data/vendor/assets/javascripts/rx.lite.compat.min.js +2 -2
  25. data/vendor/assets/javascripts/rx.lite.js +469 -464
  26. data/vendor/assets/javascripts/rx.lite.min.js +2 -2
  27. data/vendor/assets/javascripts/rx.min.js +2 -2
  28. data/vendor/assets/javascripts/rx.testing.js +165 -165
  29. data/vendor/assets/javascripts/rx.time.js +19 -19
  30. data/vendor/assets/javascripts/rx.time.min.js +1 -1
  31. data/vendor/assets/javascripts/rx.virtualtime.js +2 -2
  32. metadata +3 -2
@@ -1,27 +1,32 @@
1
- // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
1
+ // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
2
2
 
3
3
  ;(function (undefined) {
4
4
 
5
- var objectTypes = {
6
- 'boolean': false,
7
- 'function': true,
8
- 'object': true,
9
- 'number': false,
10
- 'string': false,
11
- 'undefined': false
12
- };
5
+ var objectTypes = {
6
+ 'boolean': false,
7
+ 'function': true,
8
+ 'object': true,
9
+ 'number': false,
10
+ 'string': false,
11
+ 'undefined': false
12
+ };
13
13
 
14
- var root = (objectTypes[typeof window] && window) || this,
15
- freeExports = objectTypes[typeof exports] && exports && !exports.nodeType && exports,
16
- freeModule = objectTypes[typeof module] && module && !module.nodeType && module,
17
- moduleExports = freeModule && freeModule.exports === freeExports && freeExports,
18
- freeGlobal = objectTypes[typeof global] && global;
19
-
20
- if (freeGlobal && (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal)) {
21
- root = freeGlobal;
22
- }
14
+ var root = (objectTypes[typeof window] && window) || this,
15
+ freeExports = objectTypes[typeof exports] && exports && !exports.nodeType && exports,
16
+ freeModule = objectTypes[typeof module] && module && !module.nodeType && module,
17
+ moduleExports = freeModule && freeModule.exports === freeExports && freeExports,
18
+ freeGlobal = objectTypes[typeof global] && global;
19
+
20
+ if (freeGlobal && (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal)) {
21
+ root = freeGlobal;
22
+ }
23
23
 
24
- var Rx = { internals: {}, config: {} };
24
+ var Rx = {
25
+ internals: {},
26
+ config: {
27
+ Promise: root.Promise // Detect if promise exists
28
+ }
29
+ };
25
30
 
26
31
  // Defaults
27
32
  function noop() { }
@@ -384,100 +389,100 @@
384
389
  return a;
385
390
  }
386
391
 
387
- // Collections
388
- var IndexedItem = function (id, value) {
389
- this.id = id;
390
- this.value = value;
391
- };
392
-
393
- IndexedItem.prototype.compareTo = function (other) {
394
- var c = this.value.compareTo(other.value);
395
- if (c === 0) {
396
- c = this.id - other.id;
397
- }
398
- return c;
399
- };
400
-
401
- // Priority Queue for Scheduling
402
- var PriorityQueue = Rx.internals.PriorityQueue = function (capacity) {
403
- this.items = new Array(capacity);
404
- this.length = 0;
405
- };
406
-
407
- var priorityProto = PriorityQueue.prototype;
408
- priorityProto.isHigherPriority = function (left, right) {
409
- return this.items[left].compareTo(this.items[right]) < 0;
410
- };
411
-
412
- priorityProto.percolate = function (index) {
413
- if (index >= this.length || index < 0) {
414
- return;
415
- }
416
- var parent = index - 1 >> 1;
417
- if (parent < 0 || parent === index) {
418
- return;
419
- }
420
- if (this.isHigherPriority(index, parent)) {
421
- var temp = this.items[index];
422
- this.items[index] = this.items[parent];
423
- this.items[parent] = temp;
424
- this.percolate(parent);
425
- }
426
- };
427
-
428
- priorityProto.heapify = function (index) {
429
- if (index === undefined) {
430
- index = 0;
431
- }
432
- if (index >= this.length || index < 0) {
433
- return;
434
- }
435
- var left = 2 * index + 1,
436
- right = 2 * index + 2,
437
- first = index;
438
- if (left < this.length && this.isHigherPriority(left, first)) {
439
- first = left;
440
- }
441
- if (right < this.length && this.isHigherPriority(right, first)) {
442
- first = right;
443
- }
444
- if (first !== index) {
445
- var temp = this.items[index];
446
- this.items[index] = this.items[first];
447
- this.items[first] = temp;
448
- this.heapify(first);
449
- }
450
- };
451
-
452
- priorityProto.peek = function () { return this.items[0].value; };
453
-
454
- priorityProto.removeAt = function (index) {
455
- this.items[index] = this.items[--this.length];
456
- delete this.items[this.length];
457
- this.heapify();
458
- };
459
-
460
- priorityProto.dequeue = function () {
461
- var result = this.peek();
462
- this.removeAt(0);
463
- return result;
464
- };
465
-
466
- priorityProto.enqueue = function (item) {
467
- var index = this.length++;
468
- this.items[index] = new IndexedItem(PriorityQueue.count++, item);
469
- this.percolate(index);
470
- };
471
-
472
- priorityProto.remove = function (item) {
473
- for (var i = 0; i < this.length; i++) {
474
- if (this.items[i].value === item) {
475
- this.removeAt(i);
476
- return true;
477
- }
478
- }
479
- return false;
480
- };
392
+ // Collections
393
+ var IndexedItem = function (id, value) {
394
+ this.id = id;
395
+ this.value = value;
396
+ };
397
+
398
+ IndexedItem.prototype.compareTo = function (other) {
399
+ var c = this.value.compareTo(other.value);
400
+ if (c === 0) {
401
+ c = this.id - other.id;
402
+ }
403
+ return c;
404
+ };
405
+
406
+ // Priority Queue for Scheduling
407
+ var PriorityQueue = Rx.internals.PriorityQueue = function (capacity) {
408
+ this.items = new Array(capacity);
409
+ this.length = 0;
410
+ };
411
+
412
+ var priorityProto = PriorityQueue.prototype;
413
+ priorityProto.isHigherPriority = function (left, right) {
414
+ return this.items[left].compareTo(this.items[right]) < 0;
415
+ };
416
+
417
+ priorityProto.percolate = function (index) {
418
+ if (index >= this.length || index < 0) {
419
+ return;
420
+ }
421
+ var parent = index - 1 >> 1;
422
+ if (parent < 0 || parent === index) {
423
+ return;
424
+ }
425
+ if (this.isHigherPriority(index, parent)) {
426
+ var temp = this.items[index];
427
+ this.items[index] = this.items[parent];
428
+ this.items[parent] = temp;
429
+ this.percolate(parent);
430
+ }
431
+ };
432
+
433
+ priorityProto.heapify = function (index) {
434
+ if (index === undefined) {
435
+ index = 0;
436
+ }
437
+ if (index >= this.length || index < 0) {
438
+ return;
439
+ }
440
+ var left = 2 * index + 1,
441
+ right = 2 * index + 2,
442
+ first = index;
443
+ if (left < this.length && this.isHigherPriority(left, first)) {
444
+ first = left;
445
+ }
446
+ if (right < this.length && this.isHigherPriority(right, first)) {
447
+ first = right;
448
+ }
449
+ if (first !== index) {
450
+ var temp = this.items[index];
451
+ this.items[index] = this.items[first];
452
+ this.items[first] = temp;
453
+ this.heapify(first);
454
+ }
455
+ };
456
+
457
+ priorityProto.peek = function () { return this.items[0].value; };
458
+
459
+ priorityProto.removeAt = function (index) {
460
+ this.items[index] = this.items[--this.length];
461
+ delete this.items[this.length];
462
+ this.heapify();
463
+ };
464
+
465
+ priorityProto.dequeue = function () {
466
+ var result = this.peek();
467
+ this.removeAt(0);
468
+ return result;
469
+ };
470
+
471
+ priorityProto.enqueue = function (item) {
472
+ var index = this.length++;
473
+ this.items[index] = new IndexedItem(PriorityQueue.count++, item);
474
+ this.percolate(index);
475
+ };
476
+
477
+ priorityProto.remove = function (item) {
478
+ for (var i = 0; i < this.length; i++) {
479
+ if (this.items[i].value === item) {
480
+ this.removeAt(i);
481
+ return true;
482
+ }
483
+ }
484
+ return false;
485
+ };
481
486
  PriorityQueue.count = 0;
482
487
  /**
483
488
  * Represents a group of disposable resources that are disposed together.
@@ -746,46 +751,46 @@
746
751
  return RefCountDisposable;
747
752
  })();
748
753
 
749
- function ScheduledDisposable(scheduler, disposable) {
750
- this.scheduler = scheduler;
751
- this.disposable = disposable;
752
- this.isDisposed = false;
753
- }
754
-
755
- ScheduledDisposable.prototype.dispose = function () {
756
- var parent = this;
757
- this.scheduler.schedule(function () {
758
- if (!parent.isDisposed) {
759
- parent.isDisposed = true;
760
- parent.disposable.dispose();
761
- }
762
- });
763
- };
764
-
765
- var ScheduledItem = Rx.internals.ScheduledItem = function (scheduler, state, action, dueTime, comparer) {
766
- this.scheduler = scheduler;
767
- this.state = state;
768
- this.action = action;
769
- this.dueTime = dueTime;
770
- this.comparer = comparer || defaultSubComparer;
771
- this.disposable = new SingleAssignmentDisposable();
772
- }
773
-
774
- ScheduledItem.prototype.invoke = function () {
775
- this.disposable.setDisposable(this.invokeCore());
776
- };
777
-
778
- ScheduledItem.prototype.compareTo = function (other) {
779
- return this.comparer(this.dueTime, other.dueTime);
780
- };
781
-
782
- ScheduledItem.prototype.isCancelled = function () {
783
- return this.disposable.isDisposed;
784
- };
785
-
786
- ScheduledItem.prototype.invokeCore = function () {
787
- return this.action(this.scheduler, this.state);
788
- };
754
+ function ScheduledDisposable(scheduler, disposable) {
755
+ this.scheduler = scheduler;
756
+ this.disposable = disposable;
757
+ this.isDisposed = false;
758
+ }
759
+
760
+ ScheduledDisposable.prototype.dispose = function () {
761
+ var parent = this;
762
+ this.scheduler.schedule(function () {
763
+ if (!parent.isDisposed) {
764
+ parent.isDisposed = true;
765
+ parent.disposable.dispose();
766
+ }
767
+ });
768
+ };
769
+
770
+ var ScheduledItem = Rx.internals.ScheduledItem = function (scheduler, state, action, dueTime, comparer) {
771
+ this.scheduler = scheduler;
772
+ this.state = state;
773
+ this.action = action;
774
+ this.dueTime = dueTime;
775
+ this.comparer = comparer || defaultSubComparer;
776
+ this.disposable = new SingleAssignmentDisposable();
777
+ }
778
+
779
+ ScheduledItem.prototype.invoke = function () {
780
+ this.disposable.setDisposable(this.invokeCore());
781
+ };
782
+
783
+ ScheduledItem.prototype.compareTo = function (other) {
784
+ return this.comparer(this.dueTime, other.dueTime);
785
+ };
786
+
787
+ ScheduledItem.prototype.isCancelled = function () {
788
+ return this.disposable.isDisposed;
789
+ };
790
+
791
+ ScheduledItem.prototype.invokeCore = function () {
792
+ return this.action(this.scheduler, this.state);
793
+ };
789
794
 
790
795
  /** Provides a set of static properties to access commonly used schedulers. */
791
796
  var Scheduler = Rx.Scheduler = (function () {
@@ -1053,54 +1058,54 @@
1053
1058
 
1054
1059
  var normalizeTime = Scheduler.normalize;
1055
1060
 
1056
- var SchedulePeriodicRecursive = Rx.internals.SchedulePeriodicRecursive = (function () {
1057
- function tick(command, recurse) {
1058
- recurse(0, this._period);
1059
- try {
1060
- this._state = this._action(this._state);
1061
- } catch (e) {
1062
- this._cancel.dispose();
1063
- throw e;
1064
- }
1065
- }
1066
-
1067
- function SchedulePeriodicRecursive(scheduler, state, period, action) {
1068
- this._scheduler = scheduler;
1069
- this._state = state;
1070
- this._period = period;
1071
- this._action = action;
1072
- }
1073
-
1074
- SchedulePeriodicRecursive.prototype.start = function () {
1075
- var d = new SingleAssignmentDisposable();
1076
- this._cancel = d;
1077
- d.setDisposable(this._scheduler.scheduleRecursiveWithRelativeAndState(0, this._period, tick.bind(this)));
1078
-
1079
- return d;
1080
- };
1081
-
1082
- return SchedulePeriodicRecursive;
1083
- }());
1084
-
1085
- /**
1086
- * Gets a scheduler that schedules work immediately on the current thread.
1087
- */
1088
- var immediateScheduler = Scheduler.immediate = (function () {
1089
-
1090
- function scheduleNow(state, action) { return action(this, state); }
1091
-
1092
- function scheduleRelative(state, dueTime, action) {
1093
- var dt = normalizeTime(dt);
1094
- while (dt - this.now() > 0) { }
1095
- return action(this, state);
1096
- }
1097
-
1098
- function scheduleAbsolute(state, dueTime, action) {
1099
- return this.scheduleWithRelativeAndState(state, dueTime - this.now(), action);
1100
- }
1101
-
1102
- return new Scheduler(defaultNow, scheduleNow, scheduleRelative, scheduleAbsolute);
1103
- }());
1061
+ var SchedulePeriodicRecursive = Rx.internals.SchedulePeriodicRecursive = (function () {
1062
+ function tick(command, recurse) {
1063
+ recurse(0, this._period);
1064
+ try {
1065
+ this._state = this._action(this._state);
1066
+ } catch (e) {
1067
+ this._cancel.dispose();
1068
+ throw e;
1069
+ }
1070
+ }
1071
+
1072
+ function SchedulePeriodicRecursive(scheduler, state, period, action) {
1073
+ this._scheduler = scheduler;
1074
+ this._state = state;
1075
+ this._period = period;
1076
+ this._action = action;
1077
+ }
1078
+
1079
+ SchedulePeriodicRecursive.prototype.start = function () {
1080
+ var d = new SingleAssignmentDisposable();
1081
+ this._cancel = d;
1082
+ d.setDisposable(this._scheduler.scheduleRecursiveWithRelativeAndState(0, this._period, tick.bind(this)));
1083
+
1084
+ return d;
1085
+ };
1086
+
1087
+ return SchedulePeriodicRecursive;
1088
+ }());
1089
+
1090
+ /**
1091
+ * Gets a scheduler that schedules work immediately on the current thread.
1092
+ */
1093
+ var immediateScheduler = Scheduler.immediate = (function () {
1094
+
1095
+ function scheduleNow(state, action) { return action(this, state); }
1096
+
1097
+ function scheduleRelative(state, dueTime, action) {
1098
+ var dt = normalizeTime(dt);
1099
+ while (dt - this.now() > 0) { }
1100
+ return action(this, state);
1101
+ }
1102
+
1103
+ function scheduleAbsolute(state, dueTime, action) {
1104
+ return this.scheduleWithRelativeAndState(state, dueTime - this.now(), action);
1105
+ }
1106
+
1107
+ return new Scheduler(defaultNow, scheduleNow, scheduleRelative, scheduleAbsolute);
1108
+ }());
1104
1109
 
1105
1110
  /**
1106
1111
  * Gets a scheduler that schedules work as soon as possible on the current thread.
@@ -1519,143 +1524,143 @@
1519
1524
  };
1520
1525
  }());
1521
1526
 
1522
- var Enumerator = Rx.internals.Enumerator = function (next) {
1523
- this._next = next;
1524
- };
1525
-
1526
- Enumerator.prototype.next = function () {
1527
- return this._next();
1528
- };
1529
-
1530
- Enumerator.prototype[$iterator$] = function () { return this; }
1531
-
1532
- var Enumerable = Rx.internals.Enumerable = function (iterator) {
1533
- this._iterator = iterator;
1534
- };
1535
-
1536
- Enumerable.prototype[$iterator$] = function () {
1537
- return this._iterator();
1538
- };
1539
-
1540
- Enumerable.prototype.concat = function () {
1541
- var sources = this;
1542
- return new AnonymousObservable(function (observer) {
1543
- var e;
1544
- try {
1545
- e = sources[$iterator$]();
1546
- } catch(err) {
1547
- observer.onError();
1548
- return;
1549
- }
1550
-
1551
- var isDisposed,
1552
- subscription = new SerialDisposable();
1553
- var cancelable = immediateScheduler.scheduleRecursive(function (self) {
1554
- var currentItem;
1555
- if (isDisposed) { return; }
1556
-
1557
- try {
1558
- currentItem = e.next();
1559
- } catch (ex) {
1560
- observer.onError(ex);
1561
- return;
1562
- }
1563
-
1564
- if (currentItem.done) {
1565
- observer.onCompleted();
1566
- return;
1567
- }
1568
-
1569
- var d = new SingleAssignmentDisposable();
1570
- subscription.setDisposable(d);
1571
- d.setDisposable(currentItem.value.subscribe(
1572
- observer.onNext.bind(observer),
1573
- observer.onError.bind(observer),
1574
- function () { self(); })
1575
- );
1576
- });
1577
-
1578
- return new CompositeDisposable(subscription, cancelable, disposableCreate(function () {
1579
- isDisposed = true;
1580
- }));
1581
- });
1582
- };
1583
-
1584
- Enumerable.prototype.catchException = function () {
1585
- var sources = this;
1586
- return new AnonymousObservable(function (observer) {
1587
- var e;
1588
- try {
1589
- e = sources[$iterator$]();
1590
- } catch(err) {
1591
- observer.onError();
1592
- return;
1593
- }
1594
-
1595
- var isDisposed,
1596
- lastException,
1597
- subscription = new SerialDisposable();
1598
- var cancelable = immediateScheduler.scheduleRecursive(function (self) {
1599
- if (isDisposed) { return; }
1600
-
1601
- var currentItem;
1602
- try {
1603
- currentItem = e.next();
1604
- } catch (ex) {
1605
- observer.onError(ex);
1606
- return;
1607
- }
1608
-
1609
- if (currentItem.done) {
1610
- if (lastException) {
1611
- observer.onError(lastException);
1612
- } else {
1613
- observer.onCompleted();
1614
- }
1615
- return;
1616
- }
1617
-
1618
- var d = new SingleAssignmentDisposable();
1619
- subscription.setDisposable(d);
1620
- d.setDisposable(currentItem.value.subscribe(
1621
- observer.onNext.bind(observer),
1622
- function (exn) {
1623
- lastException = exn;
1624
- self();
1625
- },
1626
- observer.onCompleted.bind(observer)));
1627
- });
1628
- return new CompositeDisposable(subscription, cancelable, disposableCreate(function () {
1629
- isDisposed = true;
1630
- }));
1631
- });
1632
- };
1633
-
1634
-
1635
- var enumerableRepeat = Enumerable.repeat = function (value, repeatCount) {
1636
- if (repeatCount == null) { repeatCount = -1; }
1637
- return new Enumerable(function () {
1638
- var left = repeatCount;
1639
- return new Enumerator(function () {
1640
- if (left === 0) { return doneEnumerator; }
1641
- if (left > 0) { left--; }
1642
- return { done: false, value: value };
1643
- });
1644
- });
1645
- };
1646
-
1647
- var enumerableFor = Enumerable.forEach = function (source, selector, thisArg) {
1648
- selector || (selector = identity);
1649
- return new Enumerable(function () {
1650
- var index = -1;
1651
- return new Enumerator(
1652
- function () {
1653
- return ++index < source.length ?
1654
- { done: false, value: selector.call(thisArg, source[index], index, source) } :
1655
- doneEnumerator;
1656
- });
1657
- });
1658
- };
1527
+ var Enumerator = Rx.internals.Enumerator = function (next) {
1528
+ this._next = next;
1529
+ };
1530
+
1531
+ Enumerator.prototype.next = function () {
1532
+ return this._next();
1533
+ };
1534
+
1535
+ Enumerator.prototype[$iterator$] = function () { return this; }
1536
+
1537
+ var Enumerable = Rx.internals.Enumerable = function (iterator) {
1538
+ this._iterator = iterator;
1539
+ };
1540
+
1541
+ Enumerable.prototype[$iterator$] = function () {
1542
+ return this._iterator();
1543
+ };
1544
+
1545
+ Enumerable.prototype.concat = function () {
1546
+ var sources = this;
1547
+ return new AnonymousObservable(function (observer) {
1548
+ var e;
1549
+ try {
1550
+ e = sources[$iterator$]();
1551
+ } catch(err) {
1552
+ observer.onError();
1553
+ return;
1554
+ }
1555
+
1556
+ var isDisposed,
1557
+ subscription = new SerialDisposable();
1558
+ var cancelable = immediateScheduler.scheduleRecursive(function (self) {
1559
+ var currentItem;
1560
+ if (isDisposed) { return; }
1561
+
1562
+ try {
1563
+ currentItem = e.next();
1564
+ } catch (ex) {
1565
+ observer.onError(ex);
1566
+ return;
1567
+ }
1568
+
1569
+ if (currentItem.done) {
1570
+ observer.onCompleted();
1571
+ return;
1572
+ }
1573
+
1574
+ var d = new SingleAssignmentDisposable();
1575
+ subscription.setDisposable(d);
1576
+ d.setDisposable(currentItem.value.subscribe(
1577
+ observer.onNext.bind(observer),
1578
+ observer.onError.bind(observer),
1579
+ function () { self(); })
1580
+ );
1581
+ });
1582
+
1583
+ return new CompositeDisposable(subscription, cancelable, disposableCreate(function () {
1584
+ isDisposed = true;
1585
+ }));
1586
+ });
1587
+ };
1588
+
1589
+ Enumerable.prototype.catchException = function () {
1590
+ var sources = this;
1591
+ return new AnonymousObservable(function (observer) {
1592
+ var e;
1593
+ try {
1594
+ e = sources[$iterator$]();
1595
+ } catch(err) {
1596
+ observer.onError();
1597
+ return;
1598
+ }
1599
+
1600
+ var isDisposed,
1601
+ lastException,
1602
+ subscription = new SerialDisposable();
1603
+ var cancelable = immediateScheduler.scheduleRecursive(function (self) {
1604
+ if (isDisposed) { return; }
1605
+
1606
+ var currentItem;
1607
+ try {
1608
+ currentItem = e.next();
1609
+ } catch (ex) {
1610
+ observer.onError(ex);
1611
+ return;
1612
+ }
1613
+
1614
+ if (currentItem.done) {
1615
+ if (lastException) {
1616
+ observer.onError(lastException);
1617
+ } else {
1618
+ observer.onCompleted();
1619
+ }
1620
+ return;
1621
+ }
1622
+
1623
+ var d = new SingleAssignmentDisposable();
1624
+ subscription.setDisposable(d);
1625
+ d.setDisposable(currentItem.value.subscribe(
1626
+ observer.onNext.bind(observer),
1627
+ function (exn) {
1628
+ lastException = exn;
1629
+ self();
1630
+ },
1631
+ observer.onCompleted.bind(observer)));
1632
+ });
1633
+ return new CompositeDisposable(subscription, cancelable, disposableCreate(function () {
1634
+ isDisposed = true;
1635
+ }));
1636
+ });
1637
+ };
1638
+
1639
+
1640
+ var enumerableRepeat = Enumerable.repeat = function (value, repeatCount) {
1641
+ if (repeatCount == null) { repeatCount = -1; }
1642
+ return new Enumerable(function () {
1643
+ var left = repeatCount;
1644
+ return new Enumerator(function () {
1645
+ if (left === 0) { return doneEnumerator; }
1646
+ if (left > 0) { left--; }
1647
+ return { done: false, value: value };
1648
+ });
1649
+ });
1650
+ };
1651
+
1652
+ var enumerableFor = Enumerable.forEach = function (source, selector, thisArg) {
1653
+ selector || (selector = identity);
1654
+ return new Enumerable(function () {
1655
+ var index = -1;
1656
+ return new Enumerator(
1657
+ function () {
1658
+ return ++index < source.length ?
1659
+ { done: false, value: selector.call(thisArg, source[index], index, source) } :
1660
+ doneEnumerator;
1661
+ });
1662
+ });
1663
+ };
1659
1664
 
1660
1665
  /**
1661
1666
  * Supports push-style iteration over an observable sequence.
@@ -4068,48 +4073,48 @@
4068
4073
  return AutoDetachObserver;
4069
4074
  }(AbstractObserver));
4070
4075
 
4071
- /** @private */
4072
- var GroupedObservable = (function (_super) {
4073
- inherits(GroupedObservable, _super);
4074
-
4075
- function subscribe(observer) {
4076
- return this.underlyingObservable.subscribe(observer);
4077
- }
4078
-
4079
- /**
4080
- * @constructor
4081
- * @private
4082
- */
4083
- function GroupedObservable(key, underlyingObservable, mergedDisposable) {
4084
- _super.call(this, subscribe);
4085
- this.key = key;
4086
- this.underlyingObservable = !mergedDisposable ?
4087
- underlyingObservable :
4088
- new AnonymousObservable(function (observer) {
4089
- return new CompositeDisposable(mergedDisposable.getDisposable(), underlyingObservable.subscribe(observer));
4090
- });
4091
- }
4092
-
4093
- return GroupedObservable;
4094
- }(Observable));
4095
-
4096
- /** @private */
4097
- var InnerSubscription = function (subject, observer) {
4098
- this.subject = subject;
4099
- this.observer = observer;
4100
- };
4101
-
4102
- /**
4103
- * @private
4104
- * @memberOf InnerSubscription
4105
- */
4106
- InnerSubscription.prototype.dispose = function () {
4107
- if (!this.subject.isDisposed && this.observer !== null) {
4108
- var idx = this.subject.observers.indexOf(this.observer);
4109
- this.subject.observers.splice(idx, 1);
4110
- this.observer = null;
4111
- }
4112
- };
4076
+ /** @private */
4077
+ var GroupedObservable = (function (_super) {
4078
+ inherits(GroupedObservable, _super);
4079
+
4080
+ function subscribe(observer) {
4081
+ return this.underlyingObservable.subscribe(observer);
4082
+ }
4083
+
4084
+ /**
4085
+ * @constructor
4086
+ * @private
4087
+ */
4088
+ function GroupedObservable(key, underlyingObservable, mergedDisposable) {
4089
+ _super.call(this, subscribe);
4090
+ this.key = key;
4091
+ this.underlyingObservable = !mergedDisposable ?
4092
+ underlyingObservable :
4093
+ new AnonymousObservable(function (observer) {
4094
+ return new CompositeDisposable(mergedDisposable.getDisposable(), underlyingObservable.subscribe(observer));
4095
+ });
4096
+ }
4097
+
4098
+ return GroupedObservable;
4099
+ }(Observable));
4100
+
4101
+ /** @private */
4102
+ var InnerSubscription = function (subject, observer) {
4103
+ this.subject = subject;
4104
+ this.observer = observer;
4105
+ };
4106
+
4107
+ /**
4108
+ * @private
4109
+ * @memberOf InnerSubscription
4110
+ */
4111
+ InnerSubscription.prototype.dispose = function () {
4112
+ if (!this.subject.isDisposed && this.observer !== null) {
4113
+ var idx = this.subject.observers.indexOf(this.observer);
4114
+ this.subject.observers.splice(idx, 1);
4115
+ this.observer = null;
4116
+ }
4117
+ };
4113
4118
 
4114
4119
  /**
4115
4120
  * Represents an object that is both an observable sequence as well as an observer.
@@ -4344,66 +4349,66 @@
4344
4349
  return AsyncSubject;
4345
4350
  }(Observable));
4346
4351
 
4347
- /** @private */
4348
- var AnonymousSubject = (function (_super) {
4349
- inherits(AnonymousSubject, _super);
4350
-
4351
- function subscribe(observer) {
4352
- return this.observable.subscribe(observer);
4353
- }
4354
-
4355
- /**
4356
- * @private
4357
- * @constructor
4358
- */
4359
- function AnonymousSubject(observer, observable) {
4360
- _super.call(this, subscribe);
4361
- this.observer = observer;
4362
- this.observable = observable;
4363
- }
4364
-
4365
- addProperties(AnonymousSubject.prototype, Observer, {
4366
- /**
4367
- * @private
4368
- * @memberOf AnonymousSubject#
4369
- */
4370
- onCompleted: function () {
4371
- this.observer.onCompleted();
4372
- },
4373
- /**
4374
- * @private
4375
- * @memberOf AnonymousSubject#
4376
- */
4377
- onError: function (exception) {
4378
- this.observer.onError(exception);
4379
- },
4380
- /**
4381
- * @private
4382
- * @memberOf AnonymousSubject#
4383
- */
4384
- onNext: function (value) {
4385
- this.observer.onNext(value);
4386
- }
4387
- });
4388
-
4389
- return AnonymousSubject;
4390
- }(Observable));
4391
-
4392
- if (typeof define == 'function' && typeof define.amd == 'object' && define.amd) {
4393
- root.Rx = Rx;
4394
-
4395
- define(function() {
4396
- return Rx;
4397
- });
4398
- } else if (freeExports && freeModule) {
4399
- // in Node.js or RingoJS
4400
- if (moduleExports) {
4401
- (freeModule.exports = Rx).Rx = Rx;
4402
- } else {
4403
- freeExports.Rx = Rx;
4404
- }
4405
- } else {
4406
- // in a browser or Rhino
4407
- root.Rx = Rx;
4352
+ /** @private */
4353
+ var AnonymousSubject = (function (_super) {
4354
+ inherits(AnonymousSubject, _super);
4355
+
4356
+ function subscribe(observer) {
4357
+ return this.observable.subscribe(observer);
4358
+ }
4359
+
4360
+ /**
4361
+ * @private
4362
+ * @constructor
4363
+ */
4364
+ function AnonymousSubject(observer, observable) {
4365
+ _super.call(this, subscribe);
4366
+ this.observer = observer;
4367
+ this.observable = observable;
4368
+ }
4369
+
4370
+ addProperties(AnonymousSubject.prototype, Observer, {
4371
+ /**
4372
+ * @private
4373
+ * @memberOf AnonymousSubject#
4374
+ */
4375
+ onCompleted: function () {
4376
+ this.observer.onCompleted();
4377
+ },
4378
+ /**
4379
+ * @private
4380
+ * @memberOf AnonymousSubject#
4381
+ */
4382
+ onError: function (exception) {
4383
+ this.observer.onError(exception);
4384
+ },
4385
+ /**
4386
+ * @private
4387
+ * @memberOf AnonymousSubject#
4388
+ */
4389
+ onNext: function (value) {
4390
+ this.observer.onNext(value);
4391
+ }
4392
+ });
4393
+
4394
+ return AnonymousSubject;
4395
+ }(Observable));
4396
+
4397
+ if (typeof define == 'function' && typeof define.amd == 'object' && define.amd) {
4398
+ root.Rx = Rx;
4399
+
4400
+ define(function() {
4401
+ return Rx;
4402
+ });
4403
+ } else if (freeExports && freeModule) {
4404
+ // in Node.js or RingoJS
4405
+ if (moduleExports) {
4406
+ (freeModule.exports = Rx).Rx = Rx;
4407
+ } else {
4408
+ freeExports.Rx = Rx;
4409
+ }
4410
+ } else {
4411
+ // in a browser or Rhino
4412
+ root.Rx = Rx;
4408
4413
  }
4409
4414
  }.call(this));