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,43 +1,48 @@
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
- // Defaults
27
- function noop() { }
28
- function identity(x) { return x; }
29
- var defaultNow = (function () { return !!Date.now ? Date.now : function () { return +new Date; }; }());
30
- function defaultComparer(x, y) { return isEqual(x, y); }
31
- function defaultSubComparer(x, y) { return x - y; }
32
- function defaultKeySerializer(x) { return x.toString(); }
33
- function defaultError(err) { throw err; }
34
- function isPromise(p) { return typeof p.then === 'function' && p.then !== Rx.Observable.prototype.then; }
35
-
36
- // Errors
37
- var sequenceContainsNoElements = 'Sequence contains no elements.';
38
- var argumentOutOfRange = 'Argument out of range';
39
- var objectDisposed = 'Object has been disposed';
40
- function checkDisposed() { if (this.isDisposed) { throw new Error(objectDisposed); } }
31
+ // Defaults
32
+ function noop() { }
33
+ function identity(x) { return x; }
34
+ var defaultNow = (function () { return !!Date.now ? Date.now : function () { return +new Date; }; }());
35
+ function defaultComparer(x, y) { return isEqual(x, y); }
36
+ function defaultSubComparer(x, y) { return x - y; }
37
+ function defaultKeySerializer(x) { return x.toString(); }
38
+ function defaultError(err) { throw err; }
39
+ function isPromise(p) { return typeof p.then === 'function' && p.then !== Rx.Observable.prototype.then; }
40
+
41
+ // Errors
42
+ var sequenceContainsNoElements = 'Sequence contains no elements.';
43
+ var argumentOutOfRange = 'Argument out of range';
44
+ var objectDisposed = 'Object has been disposed';
45
+ function checkDisposed() { if (this.isDisposed) { throw new Error(objectDisposed); } }
41
46
 
42
47
  // Shim in iterator support
43
48
  var $iterator$ = (typeof Symbol === 'object' && Symbol.iterator) ||
@@ -502,100 +507,100 @@
502
507
  };
503
508
  }
504
509
 
505
- // Collections
506
- var IndexedItem = function (id, value) {
507
- this.id = id;
508
- this.value = value;
509
- };
510
-
511
- IndexedItem.prototype.compareTo = function (other) {
512
- var c = this.value.compareTo(other.value);
513
- if (c === 0) {
514
- c = this.id - other.id;
515
- }
516
- return c;
517
- };
518
-
519
- // Priority Queue for Scheduling
520
- var PriorityQueue = Rx.internals.PriorityQueue = function (capacity) {
521
- this.items = new Array(capacity);
522
- this.length = 0;
523
- };
524
-
525
- var priorityProto = PriorityQueue.prototype;
526
- priorityProto.isHigherPriority = function (left, right) {
527
- return this.items[left].compareTo(this.items[right]) < 0;
528
- };
529
-
530
- priorityProto.percolate = function (index) {
531
- if (index >= this.length || index < 0) {
532
- return;
533
- }
534
- var parent = index - 1 >> 1;
535
- if (parent < 0 || parent === index) {
536
- return;
537
- }
538
- if (this.isHigherPriority(index, parent)) {
539
- var temp = this.items[index];
540
- this.items[index] = this.items[parent];
541
- this.items[parent] = temp;
542
- this.percolate(parent);
543
- }
544
- };
545
-
546
- priorityProto.heapify = function (index) {
547
- if (index === undefined) {
548
- index = 0;
549
- }
550
- if (index >= this.length || index < 0) {
551
- return;
552
- }
553
- var left = 2 * index + 1,
554
- right = 2 * index + 2,
555
- first = index;
556
- if (left < this.length && this.isHigherPriority(left, first)) {
557
- first = left;
558
- }
559
- if (right < this.length && this.isHigherPriority(right, first)) {
560
- first = right;
561
- }
562
- if (first !== index) {
563
- var temp = this.items[index];
564
- this.items[index] = this.items[first];
565
- this.items[first] = temp;
566
- this.heapify(first);
567
- }
568
- };
569
-
570
- priorityProto.peek = function () { return this.items[0].value; };
571
-
572
- priorityProto.removeAt = function (index) {
573
- this.items[index] = this.items[--this.length];
574
- delete this.items[this.length];
575
- this.heapify();
576
- };
577
-
578
- priorityProto.dequeue = function () {
579
- var result = this.peek();
580
- this.removeAt(0);
581
- return result;
582
- };
583
-
584
- priorityProto.enqueue = function (item) {
585
- var index = this.length++;
586
- this.items[index] = new IndexedItem(PriorityQueue.count++, item);
587
- this.percolate(index);
588
- };
589
-
590
- priorityProto.remove = function (item) {
591
- for (var i = 0; i < this.length; i++) {
592
- if (this.items[i].value === item) {
593
- this.removeAt(i);
594
- return true;
595
- }
596
- }
597
- return false;
598
- };
510
+ // Collections
511
+ var IndexedItem = function (id, value) {
512
+ this.id = id;
513
+ this.value = value;
514
+ };
515
+
516
+ IndexedItem.prototype.compareTo = function (other) {
517
+ var c = this.value.compareTo(other.value);
518
+ if (c === 0) {
519
+ c = this.id - other.id;
520
+ }
521
+ return c;
522
+ };
523
+
524
+ // Priority Queue for Scheduling
525
+ var PriorityQueue = Rx.internals.PriorityQueue = function (capacity) {
526
+ this.items = new Array(capacity);
527
+ this.length = 0;
528
+ };
529
+
530
+ var priorityProto = PriorityQueue.prototype;
531
+ priorityProto.isHigherPriority = function (left, right) {
532
+ return this.items[left].compareTo(this.items[right]) < 0;
533
+ };
534
+
535
+ priorityProto.percolate = function (index) {
536
+ if (index >= this.length || index < 0) {
537
+ return;
538
+ }
539
+ var parent = index - 1 >> 1;
540
+ if (parent < 0 || parent === index) {
541
+ return;
542
+ }
543
+ if (this.isHigherPriority(index, parent)) {
544
+ var temp = this.items[index];
545
+ this.items[index] = this.items[parent];
546
+ this.items[parent] = temp;
547
+ this.percolate(parent);
548
+ }
549
+ };
550
+
551
+ priorityProto.heapify = function (index) {
552
+ if (index === undefined) {
553
+ index = 0;
554
+ }
555
+ if (index >= this.length || index < 0) {
556
+ return;
557
+ }
558
+ var left = 2 * index + 1,
559
+ right = 2 * index + 2,
560
+ first = index;
561
+ if (left < this.length && this.isHigherPriority(left, first)) {
562
+ first = left;
563
+ }
564
+ if (right < this.length && this.isHigherPriority(right, first)) {
565
+ first = right;
566
+ }
567
+ if (first !== index) {
568
+ var temp = this.items[index];
569
+ this.items[index] = this.items[first];
570
+ this.items[first] = temp;
571
+ this.heapify(first);
572
+ }
573
+ };
574
+
575
+ priorityProto.peek = function () { return this.items[0].value; };
576
+
577
+ priorityProto.removeAt = function (index) {
578
+ this.items[index] = this.items[--this.length];
579
+ delete this.items[this.length];
580
+ this.heapify();
581
+ };
582
+
583
+ priorityProto.dequeue = function () {
584
+ var result = this.peek();
585
+ this.removeAt(0);
586
+ return result;
587
+ };
588
+
589
+ priorityProto.enqueue = function (item) {
590
+ var index = this.length++;
591
+ this.items[index] = new IndexedItem(PriorityQueue.count++, item);
592
+ this.percolate(index);
593
+ };
594
+
595
+ priorityProto.remove = function (item) {
596
+ for (var i = 0; i < this.length; i++) {
597
+ if (this.items[i].value === item) {
598
+ this.removeAt(i);
599
+ return true;
600
+ }
601
+ }
602
+ return false;
603
+ };
599
604
  PriorityQueue.count = 0;
600
605
  /**
601
606
  * Represents a group of disposable resources that are disposed together.
@@ -864,46 +869,46 @@
864
869
  return RefCountDisposable;
865
870
  })();
866
871
 
867
- function ScheduledDisposable(scheduler, disposable) {
868
- this.scheduler = scheduler;
869
- this.disposable = disposable;
870
- this.isDisposed = false;
871
- }
872
-
873
- ScheduledDisposable.prototype.dispose = function () {
874
- var parent = this;
875
- this.scheduler.schedule(function () {
876
- if (!parent.isDisposed) {
877
- parent.isDisposed = true;
878
- parent.disposable.dispose();
879
- }
880
- });
881
- };
882
-
883
- var ScheduledItem = Rx.internals.ScheduledItem = function (scheduler, state, action, dueTime, comparer) {
884
- this.scheduler = scheduler;
885
- this.state = state;
886
- this.action = action;
887
- this.dueTime = dueTime;
888
- this.comparer = comparer || defaultSubComparer;
889
- this.disposable = new SingleAssignmentDisposable();
890
- }
891
-
892
- ScheduledItem.prototype.invoke = function () {
893
- this.disposable.setDisposable(this.invokeCore());
894
- };
895
-
896
- ScheduledItem.prototype.compareTo = function (other) {
897
- return this.comparer(this.dueTime, other.dueTime);
898
- };
899
-
900
- ScheduledItem.prototype.isCancelled = function () {
901
- return this.disposable.isDisposed;
902
- };
903
-
904
- ScheduledItem.prototype.invokeCore = function () {
905
- return this.action(this.scheduler, this.state);
906
- };
872
+ function ScheduledDisposable(scheduler, disposable) {
873
+ this.scheduler = scheduler;
874
+ this.disposable = disposable;
875
+ this.isDisposed = false;
876
+ }
877
+
878
+ ScheduledDisposable.prototype.dispose = function () {
879
+ var parent = this;
880
+ this.scheduler.schedule(function () {
881
+ if (!parent.isDisposed) {
882
+ parent.isDisposed = true;
883
+ parent.disposable.dispose();
884
+ }
885
+ });
886
+ };
887
+
888
+ var ScheduledItem = Rx.internals.ScheduledItem = function (scheduler, state, action, dueTime, comparer) {
889
+ this.scheduler = scheduler;
890
+ this.state = state;
891
+ this.action = action;
892
+ this.dueTime = dueTime;
893
+ this.comparer = comparer || defaultSubComparer;
894
+ this.disposable = new SingleAssignmentDisposable();
895
+ }
896
+
897
+ ScheduledItem.prototype.invoke = function () {
898
+ this.disposable.setDisposable(this.invokeCore());
899
+ };
900
+
901
+ ScheduledItem.prototype.compareTo = function (other) {
902
+ return this.comparer(this.dueTime, other.dueTime);
903
+ };
904
+
905
+ ScheduledItem.prototype.isCancelled = function () {
906
+ return this.disposable.isDisposed;
907
+ };
908
+
909
+ ScheduledItem.prototype.invokeCore = function () {
910
+ return this.action(this.scheduler, this.state);
911
+ };
907
912
 
908
913
  /** Provides a set of static properties to access commonly used schedulers. */
909
914
  var Scheduler = Rx.Scheduler = (function () {
@@ -1171,54 +1176,54 @@
1171
1176
 
1172
1177
  var normalizeTime = Scheduler.normalize;
1173
1178
 
1174
- var SchedulePeriodicRecursive = Rx.internals.SchedulePeriodicRecursive = (function () {
1175
- function tick(command, recurse) {
1176
- recurse(0, this._period);
1177
- try {
1178
- this._state = this._action(this._state);
1179
- } catch (e) {
1180
- this._cancel.dispose();
1181
- throw e;
1182
- }
1183
- }
1184
-
1185
- function SchedulePeriodicRecursive(scheduler, state, period, action) {
1186
- this._scheduler = scheduler;
1187
- this._state = state;
1188
- this._period = period;
1189
- this._action = action;
1190
- }
1191
-
1192
- SchedulePeriodicRecursive.prototype.start = function () {
1193
- var d = new SingleAssignmentDisposable();
1194
- this._cancel = d;
1195
- d.setDisposable(this._scheduler.scheduleRecursiveWithRelativeAndState(0, this._period, tick.bind(this)));
1196
-
1197
- return d;
1198
- };
1199
-
1200
- return SchedulePeriodicRecursive;
1201
- }());
1202
-
1203
- /**
1204
- * Gets a scheduler that schedules work immediately on the current thread.
1205
- */
1206
- var immediateScheduler = Scheduler.immediate = (function () {
1207
-
1208
- function scheduleNow(state, action) { return action(this, state); }
1209
-
1210
- function scheduleRelative(state, dueTime, action) {
1211
- var dt = normalizeTime(dt);
1212
- while (dt - this.now() > 0) { }
1213
- return action(this, state);
1214
- }
1215
-
1216
- function scheduleAbsolute(state, dueTime, action) {
1217
- return this.scheduleWithRelativeAndState(state, dueTime - this.now(), action);
1218
- }
1219
-
1220
- return new Scheduler(defaultNow, scheduleNow, scheduleRelative, scheduleAbsolute);
1221
- }());
1179
+ var SchedulePeriodicRecursive = Rx.internals.SchedulePeriodicRecursive = (function () {
1180
+ function tick(command, recurse) {
1181
+ recurse(0, this._period);
1182
+ try {
1183
+ this._state = this._action(this._state);
1184
+ } catch (e) {
1185
+ this._cancel.dispose();
1186
+ throw e;
1187
+ }
1188
+ }
1189
+
1190
+ function SchedulePeriodicRecursive(scheduler, state, period, action) {
1191
+ this._scheduler = scheduler;
1192
+ this._state = state;
1193
+ this._period = period;
1194
+ this._action = action;
1195
+ }
1196
+
1197
+ SchedulePeriodicRecursive.prototype.start = function () {
1198
+ var d = new SingleAssignmentDisposable();
1199
+ this._cancel = d;
1200
+ d.setDisposable(this._scheduler.scheduleRecursiveWithRelativeAndState(0, this._period, tick.bind(this)));
1201
+
1202
+ return d;
1203
+ };
1204
+
1205
+ return SchedulePeriodicRecursive;
1206
+ }());
1207
+
1208
+ /**
1209
+ * Gets a scheduler that schedules work immediately on the current thread.
1210
+ */
1211
+ var immediateScheduler = Scheduler.immediate = (function () {
1212
+
1213
+ function scheduleNow(state, action) { return action(this, state); }
1214
+
1215
+ function scheduleRelative(state, dueTime, action) {
1216
+ var dt = normalizeTime(dt);
1217
+ while (dt - this.now() > 0) { }
1218
+ return action(this, state);
1219
+ }
1220
+
1221
+ function scheduleAbsolute(state, dueTime, action) {
1222
+ return this.scheduleWithRelativeAndState(state, dueTime - this.now(), action);
1223
+ }
1224
+
1225
+ return new Scheduler(defaultNow, scheduleNow, scheduleRelative, scheduleAbsolute);
1226
+ }());
1222
1227
 
1223
1228
  /**
1224
1229
  * Gets a scheduler that schedules work as soon as possible on the current thread.
@@ -1637,143 +1642,143 @@
1637
1642
  };
1638
1643
  }());
1639
1644
 
1640
- var Enumerator = Rx.internals.Enumerator = function (next) {
1641
- this._next = next;
1642
- };
1643
-
1644
- Enumerator.prototype.next = function () {
1645
- return this._next();
1646
- };
1647
-
1648
- Enumerator.prototype[$iterator$] = function () { return this; }
1649
-
1650
- var Enumerable = Rx.internals.Enumerable = function (iterator) {
1651
- this._iterator = iterator;
1652
- };
1653
-
1654
- Enumerable.prototype[$iterator$] = function () {
1655
- return this._iterator();
1656
- };
1657
-
1658
- Enumerable.prototype.concat = function () {
1659
- var sources = this;
1660
- return new AnonymousObservable(function (observer) {
1661
- var e;
1662
- try {
1663
- e = sources[$iterator$]();
1664
- } catch(err) {
1665
- observer.onError();
1666
- return;
1667
- }
1668
-
1669
- var isDisposed,
1670
- subscription = new SerialDisposable();
1671
- var cancelable = immediateScheduler.scheduleRecursive(function (self) {
1672
- var currentItem;
1673
- if (isDisposed) { return; }
1674
-
1675
- try {
1676
- currentItem = e.next();
1677
- } catch (ex) {
1678
- observer.onError(ex);
1679
- return;
1680
- }
1681
-
1682
- if (currentItem.done) {
1683
- observer.onCompleted();
1684
- return;
1685
- }
1686
-
1687
- var d = new SingleAssignmentDisposable();
1688
- subscription.setDisposable(d);
1689
- d.setDisposable(currentItem.value.subscribe(
1690
- observer.onNext.bind(observer),
1691
- observer.onError.bind(observer),
1692
- function () { self(); })
1693
- );
1694
- });
1695
-
1696
- return new CompositeDisposable(subscription, cancelable, disposableCreate(function () {
1697
- isDisposed = true;
1698
- }));
1699
- });
1700
- };
1701
-
1702
- Enumerable.prototype.catchException = function () {
1703
- var sources = this;
1704
- return new AnonymousObservable(function (observer) {
1705
- var e;
1706
- try {
1707
- e = sources[$iterator$]();
1708
- } catch(err) {
1709
- observer.onError();
1710
- return;
1711
- }
1712
-
1713
- var isDisposed,
1714
- lastException,
1715
- subscription = new SerialDisposable();
1716
- var cancelable = immediateScheduler.scheduleRecursive(function (self) {
1717
- if (isDisposed) { return; }
1718
-
1719
- var currentItem;
1720
- try {
1721
- currentItem = e.next();
1722
- } catch (ex) {
1723
- observer.onError(ex);
1724
- return;
1725
- }
1726
-
1727
- if (currentItem.done) {
1728
- if (lastException) {
1729
- observer.onError(lastException);
1730
- } else {
1731
- observer.onCompleted();
1732
- }
1733
- return;
1734
- }
1735
-
1736
- var d = new SingleAssignmentDisposable();
1737
- subscription.setDisposable(d);
1738
- d.setDisposable(currentItem.value.subscribe(
1739
- observer.onNext.bind(observer),
1740
- function (exn) {
1741
- lastException = exn;
1742
- self();
1743
- },
1744
- observer.onCompleted.bind(observer)));
1745
- });
1746
- return new CompositeDisposable(subscription, cancelable, disposableCreate(function () {
1747
- isDisposed = true;
1748
- }));
1749
- });
1750
- };
1751
-
1752
-
1753
- var enumerableRepeat = Enumerable.repeat = function (value, repeatCount) {
1754
- if (repeatCount == null) { repeatCount = -1; }
1755
- return new Enumerable(function () {
1756
- var left = repeatCount;
1757
- return new Enumerator(function () {
1758
- if (left === 0) { return doneEnumerator; }
1759
- if (left > 0) { left--; }
1760
- return { done: false, value: value };
1761
- });
1762
- });
1763
- };
1764
-
1765
- var enumerableFor = Enumerable.forEach = function (source, selector, thisArg) {
1766
- selector || (selector = identity);
1767
- return new Enumerable(function () {
1768
- var index = -1;
1769
- return new Enumerator(
1770
- function () {
1771
- return ++index < source.length ?
1772
- { done: false, value: selector.call(thisArg, source[index], index, source) } :
1773
- doneEnumerator;
1774
- });
1775
- });
1776
- };
1645
+ var Enumerator = Rx.internals.Enumerator = function (next) {
1646
+ this._next = next;
1647
+ };
1648
+
1649
+ Enumerator.prototype.next = function () {
1650
+ return this._next();
1651
+ };
1652
+
1653
+ Enumerator.prototype[$iterator$] = function () { return this; }
1654
+
1655
+ var Enumerable = Rx.internals.Enumerable = function (iterator) {
1656
+ this._iterator = iterator;
1657
+ };
1658
+
1659
+ Enumerable.prototype[$iterator$] = function () {
1660
+ return this._iterator();
1661
+ };
1662
+
1663
+ Enumerable.prototype.concat = function () {
1664
+ var sources = this;
1665
+ return new AnonymousObservable(function (observer) {
1666
+ var e;
1667
+ try {
1668
+ e = sources[$iterator$]();
1669
+ } catch(err) {
1670
+ observer.onError();
1671
+ return;
1672
+ }
1673
+
1674
+ var isDisposed,
1675
+ subscription = new SerialDisposable();
1676
+ var cancelable = immediateScheduler.scheduleRecursive(function (self) {
1677
+ var currentItem;
1678
+ if (isDisposed) { return; }
1679
+
1680
+ try {
1681
+ currentItem = e.next();
1682
+ } catch (ex) {
1683
+ observer.onError(ex);
1684
+ return;
1685
+ }
1686
+
1687
+ if (currentItem.done) {
1688
+ observer.onCompleted();
1689
+ return;
1690
+ }
1691
+
1692
+ var d = new SingleAssignmentDisposable();
1693
+ subscription.setDisposable(d);
1694
+ d.setDisposable(currentItem.value.subscribe(
1695
+ observer.onNext.bind(observer),
1696
+ observer.onError.bind(observer),
1697
+ function () { self(); })
1698
+ );
1699
+ });
1700
+
1701
+ return new CompositeDisposable(subscription, cancelable, disposableCreate(function () {
1702
+ isDisposed = true;
1703
+ }));
1704
+ });
1705
+ };
1706
+
1707
+ Enumerable.prototype.catchException = function () {
1708
+ var sources = this;
1709
+ return new AnonymousObservable(function (observer) {
1710
+ var e;
1711
+ try {
1712
+ e = sources[$iterator$]();
1713
+ } catch(err) {
1714
+ observer.onError();
1715
+ return;
1716
+ }
1717
+
1718
+ var isDisposed,
1719
+ lastException,
1720
+ subscription = new SerialDisposable();
1721
+ var cancelable = immediateScheduler.scheduleRecursive(function (self) {
1722
+ if (isDisposed) { return; }
1723
+
1724
+ var currentItem;
1725
+ try {
1726
+ currentItem = e.next();
1727
+ } catch (ex) {
1728
+ observer.onError(ex);
1729
+ return;
1730
+ }
1731
+
1732
+ if (currentItem.done) {
1733
+ if (lastException) {
1734
+ observer.onError(lastException);
1735
+ } else {
1736
+ observer.onCompleted();
1737
+ }
1738
+ return;
1739
+ }
1740
+
1741
+ var d = new SingleAssignmentDisposable();
1742
+ subscription.setDisposable(d);
1743
+ d.setDisposable(currentItem.value.subscribe(
1744
+ observer.onNext.bind(observer),
1745
+ function (exn) {
1746
+ lastException = exn;
1747
+ self();
1748
+ },
1749
+ observer.onCompleted.bind(observer)));
1750
+ });
1751
+ return new CompositeDisposable(subscription, cancelable, disposableCreate(function () {
1752
+ isDisposed = true;
1753
+ }));
1754
+ });
1755
+ };
1756
+
1757
+
1758
+ var enumerableRepeat = Enumerable.repeat = function (value, repeatCount) {
1759
+ if (repeatCount == null) { repeatCount = -1; }
1760
+ return new Enumerable(function () {
1761
+ var left = repeatCount;
1762
+ return new Enumerator(function () {
1763
+ if (left === 0) { return doneEnumerator; }
1764
+ if (left > 0) { left--; }
1765
+ return { done: false, value: value };
1766
+ });
1767
+ });
1768
+ };
1769
+
1770
+ var enumerableFor = Enumerable.forEach = function (source, selector, thisArg) {
1771
+ selector || (selector = identity);
1772
+ return new Enumerable(function () {
1773
+ var index = -1;
1774
+ return new Enumerator(
1775
+ function () {
1776
+ return ++index < source.length ?
1777
+ { done: false, value: selector.call(thisArg, source[index], index, source) } :
1778
+ doneEnumerator;
1779
+ });
1780
+ });
1781
+ };
1777
1782
 
1778
1783
  /**
1779
1784
  * Supports push-style iteration over an observable sequence.
@@ -4186,48 +4191,48 @@
4186
4191
  return AutoDetachObserver;
4187
4192
  }(AbstractObserver));
4188
4193
 
4189
- /** @private */
4190
- var GroupedObservable = (function (_super) {
4191
- inherits(GroupedObservable, _super);
4192
-
4193
- function subscribe(observer) {
4194
- return this.underlyingObservable.subscribe(observer);
4195
- }
4196
-
4197
- /**
4198
- * @constructor
4199
- * @private
4200
- */
4201
- function GroupedObservable(key, underlyingObservable, mergedDisposable) {
4202
- _super.call(this, subscribe);
4203
- this.key = key;
4204
- this.underlyingObservable = !mergedDisposable ?
4205
- underlyingObservable :
4206
- new AnonymousObservable(function (observer) {
4207
- return new CompositeDisposable(mergedDisposable.getDisposable(), underlyingObservable.subscribe(observer));
4208
- });
4209
- }
4210
-
4211
- return GroupedObservable;
4212
- }(Observable));
4213
-
4214
- /** @private */
4215
- var InnerSubscription = function (subject, observer) {
4216
- this.subject = subject;
4217
- this.observer = observer;
4218
- };
4219
-
4220
- /**
4221
- * @private
4222
- * @memberOf InnerSubscription
4223
- */
4224
- InnerSubscription.prototype.dispose = function () {
4225
- if (!this.subject.isDisposed && this.observer !== null) {
4226
- var idx = this.subject.observers.indexOf(this.observer);
4227
- this.subject.observers.splice(idx, 1);
4228
- this.observer = null;
4229
- }
4230
- };
4194
+ /** @private */
4195
+ var GroupedObservable = (function (_super) {
4196
+ inherits(GroupedObservable, _super);
4197
+
4198
+ function subscribe(observer) {
4199
+ return this.underlyingObservable.subscribe(observer);
4200
+ }
4201
+
4202
+ /**
4203
+ * @constructor
4204
+ * @private
4205
+ */
4206
+ function GroupedObservable(key, underlyingObservable, mergedDisposable) {
4207
+ _super.call(this, subscribe);
4208
+ this.key = key;
4209
+ this.underlyingObservable = !mergedDisposable ?
4210
+ underlyingObservable :
4211
+ new AnonymousObservable(function (observer) {
4212
+ return new CompositeDisposable(mergedDisposable.getDisposable(), underlyingObservable.subscribe(observer));
4213
+ });
4214
+ }
4215
+
4216
+ return GroupedObservable;
4217
+ }(Observable));
4218
+
4219
+ /** @private */
4220
+ var InnerSubscription = function (subject, observer) {
4221
+ this.subject = subject;
4222
+ this.observer = observer;
4223
+ };
4224
+
4225
+ /**
4226
+ * @private
4227
+ * @memberOf InnerSubscription
4228
+ */
4229
+ InnerSubscription.prototype.dispose = function () {
4230
+ if (!this.subject.isDisposed && this.observer !== null) {
4231
+ var idx = this.subject.observers.indexOf(this.observer);
4232
+ this.subject.observers.splice(idx, 1);
4233
+ this.observer = null;
4234
+ }
4235
+ };
4231
4236
 
4232
4237
  /**
4233
4238
  * Represents an object that is both an observable sequence as well as an observer.
@@ -4462,66 +4467,66 @@
4462
4467
  return AsyncSubject;
4463
4468
  }(Observable));
4464
4469
 
4465
- /** @private */
4466
- var AnonymousSubject = (function (_super) {
4467
- inherits(AnonymousSubject, _super);
4468
-
4469
- function subscribe(observer) {
4470
- return this.observable.subscribe(observer);
4471
- }
4472
-
4473
- /**
4474
- * @private
4475
- * @constructor
4476
- */
4477
- function AnonymousSubject(observer, observable) {
4478
- _super.call(this, subscribe);
4479
- this.observer = observer;
4480
- this.observable = observable;
4481
- }
4482
-
4483
- addProperties(AnonymousSubject.prototype, Observer, {
4484
- /**
4485
- * @private
4486
- * @memberOf AnonymousSubject#
4487
- */
4488
- onCompleted: function () {
4489
- this.observer.onCompleted();
4490
- },
4491
- /**
4492
- * @private
4493
- * @memberOf AnonymousSubject#
4494
- */
4495
- onError: function (exception) {
4496
- this.observer.onError(exception);
4497
- },
4498
- /**
4499
- * @private
4500
- * @memberOf AnonymousSubject#
4501
- */
4502
- onNext: function (value) {
4503
- this.observer.onNext(value);
4504
- }
4505
- });
4506
-
4507
- return AnonymousSubject;
4508
- }(Observable));
4509
-
4510
- if (typeof define == 'function' && typeof define.amd == 'object' && define.amd) {
4511
- root.Rx = Rx;
4512
-
4513
- define(function() {
4514
- return Rx;
4515
- });
4516
- } else if (freeExports && freeModule) {
4517
- // in Node.js or RingoJS
4518
- if (moduleExports) {
4519
- (freeModule.exports = Rx).Rx = Rx;
4520
- } else {
4521
- freeExports.Rx = Rx;
4522
- }
4523
- } else {
4524
- // in a browser or Rhino
4525
- root.Rx = Rx;
4470
+ /** @private */
4471
+ var AnonymousSubject = (function (_super) {
4472
+ inherits(AnonymousSubject, _super);
4473
+
4474
+ function subscribe(observer) {
4475
+ return this.observable.subscribe(observer);
4476
+ }
4477
+
4478
+ /**
4479
+ * @private
4480
+ * @constructor
4481
+ */
4482
+ function AnonymousSubject(observer, observable) {
4483
+ _super.call(this, subscribe);
4484
+ this.observer = observer;
4485
+ this.observable = observable;
4486
+ }
4487
+
4488
+ addProperties(AnonymousSubject.prototype, Observer, {
4489
+ /**
4490
+ * @private
4491
+ * @memberOf AnonymousSubject#
4492
+ */
4493
+ onCompleted: function () {
4494
+ this.observer.onCompleted();
4495
+ },
4496
+ /**
4497
+ * @private
4498
+ * @memberOf AnonymousSubject#
4499
+ */
4500
+ onError: function (exception) {
4501
+ this.observer.onError(exception);
4502
+ },
4503
+ /**
4504
+ * @private
4505
+ * @memberOf AnonymousSubject#
4506
+ */
4507
+ onNext: function (value) {
4508
+ this.observer.onNext(value);
4509
+ }
4510
+ });
4511
+
4512
+ return AnonymousSubject;
4513
+ }(Observable));
4514
+
4515
+ if (typeof define == 'function' && typeof define.amd == 'object' && define.amd) {
4516
+ root.Rx = Rx;
4517
+
4518
+ define(function() {
4519
+ return Rx;
4520
+ });
4521
+ } else if (freeExports && freeModule) {
4522
+ // in Node.js or RingoJS
4523
+ if (moduleExports) {
4524
+ (freeModule.exports = Rx).Rx = Rx;
4525
+ } else {
4526
+ freeExports.Rx = Rx;
4527
+ }
4528
+ } else {
4529
+ // in a browser or Rhino
4530
+ root.Rx = Rx;
4526
4531
  }
4527
4532
  }.call(this));