rxjs-rails 2.2.20 → 2.2.26
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rxjs/rails/version.rb +1 -1
- data/vendor/assets/javascripts/rx.aggregates.js +38 -20
- data/vendor/assets/javascripts/rx.aggregates.min.js +1 -1
- data/vendor/assets/javascripts/rx.all.compat.js +9288 -0
- data/vendor/assets/javascripts/rx.all.compat.min.js +3 -0
- data/vendor/assets/javascripts/rx.all.js +9102 -0
- data/vendor/assets/javascripts/rx.all.min.js +3 -0
- data/vendor/assets/javascripts/rx.async.compat.js +5 -4
- data/vendor/assets/javascripts/rx.async.compat.min.js +1 -1
- data/vendor/assets/javascripts/rx.async.js +5 -4
- data/vendor/assets/javascripts/rx.async.min.js +1 -1
- data/vendor/assets/javascripts/rx.backpressure.js +24 -12
- data/vendor/assets/javascripts/rx.backpressure.min.js +1 -1
- data/vendor/assets/javascripts/rx.binding.js +85 -85
- data/vendor/assets/javascripts/rx.coincidence.js +59 -15
- data/vendor/assets/javascripts/rx.coincidence.min.js +1 -1
- data/vendor/assets/javascripts/rx.compat.js +809 -742
- data/vendor/assets/javascripts/rx.compat.min.js +2 -2
- data/vendor/assets/javascripts/rx.core.compat.js +2629 -0
- data/vendor/assets/javascripts/rx.core.compat.min.js +1 -0
- data/vendor/assets/javascripts/rx.core.js +2511 -0
- data/vendor/assets/javascripts/rx.core.min.js +1 -0
- data/vendor/assets/javascripts/rx.experimental.js +43 -43
- data/vendor/assets/javascripts/rx.joinpatterns.js +281 -281
- data/vendor/assets/javascripts/rx.js +792 -725
- data/vendor/assets/javascripts/rx.lite.compat.js +890 -758
- data/vendor/assets/javascripts/rx.lite.compat.min.js +2 -2
- data/vendor/assets/javascripts/rx.lite.extras.js +664 -0
- data/vendor/assets/javascripts/rx.lite.extras.min.js +1 -0
- data/vendor/assets/javascripts/rx.lite.js +890 -758
- data/vendor/assets/javascripts/rx.lite.min.js +2 -2
- data/vendor/assets/javascripts/rx.min.js +2 -2
- data/vendor/assets/javascripts/rx.testing.js +166 -166
- data/vendor/assets/javascripts/rx.testing.min.js +1 -1
- data/vendor/assets/javascripts/rx.time.js +132 -131
- data/vendor/assets/javascripts/rx.time.min.js +1 -1
- data/vendor/assets/javascripts/rx.virtualtime.js +2 -2
- metadata +13 -4
- data/vendor/assets/javascripts/rx.node.js +0 -142
@@ -1,4 +1,4 @@
|
|
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
|
|
@@ -29,23 +29,23 @@
|
|
29
29
|
helpers: { }
|
30
30
|
};
|
31
31
|
|
32
|
-
// Defaults
|
33
|
-
var noop = Rx.helpers.noop = function () { },
|
34
|
-
identity = Rx.helpers.identity = function (x) { return x; },
|
35
|
-
defaultNow = Rx.helpers.defaultNow = (function () { return !!Date.now ? Date.now : function () { return +new Date; }; }()),
|
36
|
-
defaultComparer = Rx.helpers.defaultComparer = function (x, y) { return isEqual(x, y); },
|
37
|
-
defaultSubComparer = Rx.helpers.defaultSubComparer = function (x, y) { return x > y ? 1 : (x < y ? -1 : 0); },
|
38
|
-
defaultKeySerializer = Rx.helpers.defaultKeySerializer = function (x) { return x.toString(); },
|
39
|
-
defaultError = Rx.helpers.defaultError = function (err) { throw err; },
|
40
|
-
isPromise = Rx.helpers.isPromise = function (p) { return !!p && typeof p.then === 'function' && p.then !== Rx.Observable.prototype.then; },
|
41
|
-
asArray = Rx.helpers.asArray = function () { return Array.prototype.slice.call(arguments); },
|
42
|
-
not = Rx.helpers.not = function (a) { return !a; };
|
43
|
-
|
44
|
-
// Errors
|
45
|
-
var sequenceContainsNoElements = 'Sequence contains no elements.';
|
46
|
-
var argumentOutOfRange = 'Argument out of range';
|
47
|
-
var objectDisposed = 'Object has been disposed';
|
48
|
-
function checkDisposed() { if (this.isDisposed) { throw new Error(objectDisposed); } }
|
32
|
+
// Defaults
|
33
|
+
var noop = Rx.helpers.noop = function () { },
|
34
|
+
identity = Rx.helpers.identity = function (x) { return x; },
|
35
|
+
defaultNow = Rx.helpers.defaultNow = (function () { return !!Date.now ? Date.now : function () { return +new Date; }; }()),
|
36
|
+
defaultComparer = Rx.helpers.defaultComparer = function (x, y) { return isEqual(x, y); },
|
37
|
+
defaultSubComparer = Rx.helpers.defaultSubComparer = function (x, y) { return x > y ? 1 : (x < y ? -1 : 0); },
|
38
|
+
defaultKeySerializer = Rx.helpers.defaultKeySerializer = function (x) { return x.toString(); },
|
39
|
+
defaultError = Rx.helpers.defaultError = function (err) { throw err; },
|
40
|
+
isPromise = Rx.helpers.isPromise = function (p) { return !!p && typeof p.then === 'function' && p.then !== Rx.Observable.prototype.then; },
|
41
|
+
asArray = Rx.helpers.asArray = function () { return Array.prototype.slice.call(arguments); },
|
42
|
+
not = Rx.helpers.not = function (a) { return !a; };
|
43
|
+
|
44
|
+
// Errors
|
45
|
+
var sequenceContainsNoElements = 'Sequence contains no elements.';
|
46
|
+
var argumentOutOfRange = 'Argument out of range';
|
47
|
+
var objectDisposed = 'Object has been disposed';
|
48
|
+
function checkDisposed() { if (this.isDisposed) { throw new Error(objectDisposed); } }
|
49
49
|
|
50
50
|
// Shim in iterator support
|
51
51
|
var $iterator$ = (typeof Symbol === 'object' && Symbol.iterator) ||
|
@@ -198,7 +198,7 @@
|
|
198
198
|
}
|
199
199
|
|
200
200
|
function isFunction(value) {
|
201
|
-
return typeof value == 'function';
|
201
|
+
return typeof value == 'function' || false;
|
202
202
|
}
|
203
203
|
|
204
204
|
// fallback for older versions of Chrome and Safari
|
@@ -510,100 +510,100 @@
|
|
510
510
|
};
|
511
511
|
}
|
512
512
|
|
513
|
-
// Collections
|
514
|
-
var IndexedItem = function (id, value) {
|
515
|
-
this.id = id;
|
516
|
-
this.value = value;
|
517
|
-
};
|
518
|
-
|
519
|
-
IndexedItem.prototype.compareTo = function (other) {
|
520
|
-
var c = this.value.compareTo(other.value);
|
521
|
-
if (c === 0) {
|
522
|
-
c = this.id - other.id;
|
523
|
-
}
|
524
|
-
return c;
|
525
|
-
};
|
526
|
-
|
527
|
-
// Priority Queue for Scheduling
|
528
|
-
var PriorityQueue = Rx.internals.PriorityQueue = function (capacity) {
|
529
|
-
this.items = new Array(capacity);
|
530
|
-
this.length = 0;
|
531
|
-
};
|
532
|
-
|
533
|
-
var priorityProto = PriorityQueue.prototype;
|
534
|
-
priorityProto.isHigherPriority = function (left, right) {
|
535
|
-
return this.items[left].compareTo(this.items[right]) < 0;
|
536
|
-
};
|
537
|
-
|
538
|
-
priorityProto.percolate = function (index) {
|
539
|
-
if (index >= this.length || index < 0) {
|
540
|
-
return;
|
541
|
-
}
|
542
|
-
var parent = index - 1 >> 1;
|
543
|
-
if (parent < 0 || parent === index) {
|
544
|
-
return;
|
545
|
-
}
|
546
|
-
if (this.isHigherPriority(index, parent)) {
|
547
|
-
var temp = this.items[index];
|
548
|
-
this.items[index] = this.items[parent];
|
549
|
-
this.items[parent] = temp;
|
550
|
-
this.percolate(parent);
|
551
|
-
}
|
552
|
-
};
|
553
|
-
|
554
|
-
priorityProto.heapify = function (index) {
|
555
|
-
if (index === undefined) {
|
556
|
-
index = 0;
|
557
|
-
}
|
558
|
-
if (index >= this.length || index < 0) {
|
559
|
-
return;
|
560
|
-
}
|
561
|
-
var left = 2 * index + 1,
|
562
|
-
right = 2 * index + 2,
|
563
|
-
first = index;
|
564
|
-
if (left < this.length && this.isHigherPriority(left, first)) {
|
565
|
-
first = left;
|
566
|
-
}
|
567
|
-
if (right < this.length && this.isHigherPriority(right, first)) {
|
568
|
-
first = right;
|
569
|
-
}
|
570
|
-
if (first !== index) {
|
571
|
-
var temp = this.items[index];
|
572
|
-
this.items[index] = this.items[first];
|
573
|
-
this.items[first] = temp;
|
574
|
-
this.heapify(first);
|
575
|
-
}
|
576
|
-
};
|
577
|
-
|
578
|
-
priorityProto.peek = function () { return this.items[0].value; };
|
579
|
-
|
580
|
-
priorityProto.removeAt = function (index) {
|
581
|
-
this.items[index] = this.items[--this.length];
|
582
|
-
delete this.items[this.length];
|
583
|
-
this.heapify();
|
584
|
-
};
|
585
|
-
|
586
|
-
priorityProto.dequeue = function () {
|
587
|
-
var result = this.peek();
|
588
|
-
this.removeAt(0);
|
589
|
-
return result;
|
590
|
-
};
|
591
|
-
|
592
|
-
priorityProto.enqueue = function (item) {
|
593
|
-
var index = this.length++;
|
594
|
-
this.items[index] = new IndexedItem(PriorityQueue.count++, item);
|
595
|
-
this.percolate(index);
|
596
|
-
};
|
597
|
-
|
598
|
-
priorityProto.remove = function (item) {
|
599
|
-
for (var i = 0; i < this.length; i++) {
|
600
|
-
if (this.items[i].value === item) {
|
601
|
-
this.removeAt(i);
|
602
|
-
return true;
|
603
|
-
}
|
604
|
-
}
|
605
|
-
return false;
|
606
|
-
};
|
513
|
+
// Collections
|
514
|
+
var IndexedItem = function (id, value) {
|
515
|
+
this.id = id;
|
516
|
+
this.value = value;
|
517
|
+
};
|
518
|
+
|
519
|
+
IndexedItem.prototype.compareTo = function (other) {
|
520
|
+
var c = this.value.compareTo(other.value);
|
521
|
+
if (c === 0) {
|
522
|
+
c = this.id - other.id;
|
523
|
+
}
|
524
|
+
return c;
|
525
|
+
};
|
526
|
+
|
527
|
+
// Priority Queue for Scheduling
|
528
|
+
var PriorityQueue = Rx.internals.PriorityQueue = function (capacity) {
|
529
|
+
this.items = new Array(capacity);
|
530
|
+
this.length = 0;
|
531
|
+
};
|
532
|
+
|
533
|
+
var priorityProto = PriorityQueue.prototype;
|
534
|
+
priorityProto.isHigherPriority = function (left, right) {
|
535
|
+
return this.items[left].compareTo(this.items[right]) < 0;
|
536
|
+
};
|
537
|
+
|
538
|
+
priorityProto.percolate = function (index) {
|
539
|
+
if (index >= this.length || index < 0) {
|
540
|
+
return;
|
541
|
+
}
|
542
|
+
var parent = index - 1 >> 1;
|
543
|
+
if (parent < 0 || parent === index) {
|
544
|
+
return;
|
545
|
+
}
|
546
|
+
if (this.isHigherPriority(index, parent)) {
|
547
|
+
var temp = this.items[index];
|
548
|
+
this.items[index] = this.items[parent];
|
549
|
+
this.items[parent] = temp;
|
550
|
+
this.percolate(parent);
|
551
|
+
}
|
552
|
+
};
|
553
|
+
|
554
|
+
priorityProto.heapify = function (index) {
|
555
|
+
if (index === undefined) {
|
556
|
+
index = 0;
|
557
|
+
}
|
558
|
+
if (index >= this.length || index < 0) {
|
559
|
+
return;
|
560
|
+
}
|
561
|
+
var left = 2 * index + 1,
|
562
|
+
right = 2 * index + 2,
|
563
|
+
first = index;
|
564
|
+
if (left < this.length && this.isHigherPriority(left, first)) {
|
565
|
+
first = left;
|
566
|
+
}
|
567
|
+
if (right < this.length && this.isHigherPriority(right, first)) {
|
568
|
+
first = right;
|
569
|
+
}
|
570
|
+
if (first !== index) {
|
571
|
+
var temp = this.items[index];
|
572
|
+
this.items[index] = this.items[first];
|
573
|
+
this.items[first] = temp;
|
574
|
+
this.heapify(first);
|
575
|
+
}
|
576
|
+
};
|
577
|
+
|
578
|
+
priorityProto.peek = function () { return this.items[0].value; };
|
579
|
+
|
580
|
+
priorityProto.removeAt = function (index) {
|
581
|
+
this.items[index] = this.items[--this.length];
|
582
|
+
delete this.items[this.length];
|
583
|
+
this.heapify();
|
584
|
+
};
|
585
|
+
|
586
|
+
priorityProto.dequeue = function () {
|
587
|
+
var result = this.peek();
|
588
|
+
this.removeAt(0);
|
589
|
+
return result;
|
590
|
+
};
|
591
|
+
|
592
|
+
priorityProto.enqueue = function (item) {
|
593
|
+
var index = this.length++;
|
594
|
+
this.items[index] = new IndexedItem(PriorityQueue.count++, item);
|
595
|
+
this.percolate(index);
|
596
|
+
};
|
597
|
+
|
598
|
+
priorityProto.remove = function (item) {
|
599
|
+
for (var i = 0; i < this.length; i++) {
|
600
|
+
if (this.items[i].value === item) {
|
601
|
+
this.removeAt(i);
|
602
|
+
return true;
|
603
|
+
}
|
604
|
+
}
|
605
|
+
return false;
|
606
|
+
};
|
607
607
|
PriorityQueue.count = 0;
|
608
608
|
/**
|
609
609
|
* Represents a group of disposable resources that are disposed together.
|
@@ -872,46 +872,46 @@
|
|
872
872
|
return RefCountDisposable;
|
873
873
|
})();
|
874
874
|
|
875
|
-
function ScheduledDisposable(scheduler, disposable) {
|
876
|
-
this.scheduler = scheduler;
|
877
|
-
this.disposable = disposable;
|
878
|
-
this.isDisposed = false;
|
879
|
-
}
|
880
|
-
|
881
|
-
ScheduledDisposable.prototype.dispose = function () {
|
882
|
-
var parent = this;
|
883
|
-
this.scheduler.schedule(function () {
|
884
|
-
if (!parent.isDisposed) {
|
885
|
-
parent.isDisposed = true;
|
886
|
-
parent.disposable.dispose();
|
887
|
-
}
|
888
|
-
});
|
889
|
-
};
|
890
|
-
|
891
|
-
var ScheduledItem = Rx.internals.ScheduledItem = function (scheduler, state, action, dueTime, comparer) {
|
892
|
-
this.scheduler = scheduler;
|
893
|
-
this.state = state;
|
894
|
-
this.action = action;
|
895
|
-
this.dueTime = dueTime;
|
896
|
-
this.comparer = comparer || defaultSubComparer;
|
897
|
-
this.disposable = new SingleAssignmentDisposable();
|
898
|
-
}
|
899
|
-
|
900
|
-
ScheduledItem.prototype.invoke = function () {
|
901
|
-
this.disposable.setDisposable(this.invokeCore());
|
902
|
-
};
|
903
|
-
|
904
|
-
ScheduledItem.prototype.compareTo = function (other) {
|
905
|
-
return this.comparer(this.dueTime, other.dueTime);
|
906
|
-
};
|
907
|
-
|
908
|
-
ScheduledItem.prototype.isCancelled = function () {
|
909
|
-
return this.disposable.isDisposed;
|
910
|
-
};
|
911
|
-
|
912
|
-
ScheduledItem.prototype.invokeCore = function () {
|
913
|
-
return this.action(this.scheduler, this.state);
|
914
|
-
};
|
875
|
+
function ScheduledDisposable(scheduler, disposable) {
|
876
|
+
this.scheduler = scheduler;
|
877
|
+
this.disposable = disposable;
|
878
|
+
this.isDisposed = false;
|
879
|
+
}
|
880
|
+
|
881
|
+
ScheduledDisposable.prototype.dispose = function () {
|
882
|
+
var parent = this;
|
883
|
+
this.scheduler.schedule(function () {
|
884
|
+
if (!parent.isDisposed) {
|
885
|
+
parent.isDisposed = true;
|
886
|
+
parent.disposable.dispose();
|
887
|
+
}
|
888
|
+
});
|
889
|
+
};
|
890
|
+
|
891
|
+
var ScheduledItem = Rx.internals.ScheduledItem = function (scheduler, state, action, dueTime, comparer) {
|
892
|
+
this.scheduler = scheduler;
|
893
|
+
this.state = state;
|
894
|
+
this.action = action;
|
895
|
+
this.dueTime = dueTime;
|
896
|
+
this.comparer = comparer || defaultSubComparer;
|
897
|
+
this.disposable = new SingleAssignmentDisposable();
|
898
|
+
}
|
899
|
+
|
900
|
+
ScheduledItem.prototype.invoke = function () {
|
901
|
+
this.disposable.setDisposable(this.invokeCore());
|
902
|
+
};
|
903
|
+
|
904
|
+
ScheduledItem.prototype.compareTo = function (other) {
|
905
|
+
return this.comparer(this.dueTime, other.dueTime);
|
906
|
+
};
|
907
|
+
|
908
|
+
ScheduledItem.prototype.isCancelled = function () {
|
909
|
+
return this.disposable.isDisposed;
|
910
|
+
};
|
911
|
+
|
912
|
+
ScheduledItem.prototype.invokeCore = function () {
|
913
|
+
return this.action(this.scheduler, this.state);
|
914
|
+
};
|
915
915
|
|
916
916
|
/** Provides a set of static properties to access commonly used schedulers. */
|
917
917
|
var Scheduler = Rx.Scheduler = (function () {
|
@@ -1179,54 +1179,54 @@
|
|
1179
1179
|
|
1180
1180
|
var normalizeTime = Scheduler.normalize;
|
1181
1181
|
|
1182
|
-
var SchedulePeriodicRecursive = Rx.internals.SchedulePeriodicRecursive = (function () {
|
1183
|
-
function tick(command, recurse) {
|
1184
|
-
recurse(0, this._period);
|
1185
|
-
try {
|
1186
|
-
this._state = this._action(this._state);
|
1187
|
-
} catch (e) {
|
1188
|
-
this._cancel.dispose();
|
1189
|
-
throw e;
|
1190
|
-
}
|
1191
|
-
}
|
1192
|
-
|
1193
|
-
function SchedulePeriodicRecursive(scheduler, state, period, action) {
|
1194
|
-
this._scheduler = scheduler;
|
1195
|
-
this._state = state;
|
1196
|
-
this._period = period;
|
1197
|
-
this._action = action;
|
1198
|
-
}
|
1199
|
-
|
1200
|
-
SchedulePeriodicRecursive.prototype.start = function () {
|
1201
|
-
var d = new SingleAssignmentDisposable();
|
1202
|
-
this._cancel = d;
|
1203
|
-
d.setDisposable(this._scheduler.scheduleRecursiveWithRelativeAndState(0, this._period, tick.bind(this)));
|
1204
|
-
|
1205
|
-
return d;
|
1206
|
-
};
|
1207
|
-
|
1208
|
-
return SchedulePeriodicRecursive;
|
1209
|
-
}());
|
1210
|
-
|
1211
|
-
/**
|
1212
|
-
* Gets a scheduler that schedules work immediately on the current thread.
|
1213
|
-
*/
|
1214
|
-
var immediateScheduler = Scheduler.immediate = (function () {
|
1215
|
-
|
1216
|
-
function scheduleNow(state, action) { return action(this, state); }
|
1217
|
-
|
1218
|
-
function scheduleRelative(state, dueTime, action) {
|
1219
|
-
var dt = normalizeTime(dt);
|
1220
|
-
while (dt - this.now() > 0) { }
|
1221
|
-
return action(this, state);
|
1222
|
-
}
|
1223
|
-
|
1224
|
-
function scheduleAbsolute(state, dueTime, action) {
|
1225
|
-
return this.scheduleWithRelativeAndState(state, dueTime - this.now(), action);
|
1226
|
-
}
|
1227
|
-
|
1228
|
-
return new Scheduler(defaultNow, scheduleNow, scheduleRelative, scheduleAbsolute);
|
1229
|
-
}());
|
1182
|
+
var SchedulePeriodicRecursive = Rx.internals.SchedulePeriodicRecursive = (function () {
|
1183
|
+
function tick(command, recurse) {
|
1184
|
+
recurse(0, this._period);
|
1185
|
+
try {
|
1186
|
+
this._state = this._action(this._state);
|
1187
|
+
} catch (e) {
|
1188
|
+
this._cancel.dispose();
|
1189
|
+
throw e;
|
1190
|
+
}
|
1191
|
+
}
|
1192
|
+
|
1193
|
+
function SchedulePeriodicRecursive(scheduler, state, period, action) {
|
1194
|
+
this._scheduler = scheduler;
|
1195
|
+
this._state = state;
|
1196
|
+
this._period = period;
|
1197
|
+
this._action = action;
|
1198
|
+
}
|
1199
|
+
|
1200
|
+
SchedulePeriodicRecursive.prototype.start = function () {
|
1201
|
+
var d = new SingleAssignmentDisposable();
|
1202
|
+
this._cancel = d;
|
1203
|
+
d.setDisposable(this._scheduler.scheduleRecursiveWithRelativeAndState(0, this._period, tick.bind(this)));
|
1204
|
+
|
1205
|
+
return d;
|
1206
|
+
};
|
1207
|
+
|
1208
|
+
return SchedulePeriodicRecursive;
|
1209
|
+
}());
|
1210
|
+
|
1211
|
+
/**
|
1212
|
+
* Gets a scheduler that schedules work immediately on the current thread.
|
1213
|
+
*/
|
1214
|
+
var immediateScheduler = Scheduler.immediate = (function () {
|
1215
|
+
|
1216
|
+
function scheduleNow(state, action) { return action(this, state); }
|
1217
|
+
|
1218
|
+
function scheduleRelative(state, dueTime, action) {
|
1219
|
+
var dt = normalizeTime(dt);
|
1220
|
+
while (dt - this.now() > 0) { }
|
1221
|
+
return action(this, state);
|
1222
|
+
}
|
1223
|
+
|
1224
|
+
function scheduleAbsolute(state, dueTime, action) {
|
1225
|
+
return this.scheduleWithRelativeAndState(state, dueTime - this.now(), action);
|
1226
|
+
}
|
1227
|
+
|
1228
|
+
return new Scheduler(defaultNow, scheduleNow, scheduleRelative, scheduleAbsolute);
|
1229
|
+
}());
|
1230
1230
|
|
1231
1231
|
/**
|
1232
1232
|
* Gets a scheduler that schedules work as soon as possible on the current thread.
|
@@ -1645,231 +1645,230 @@
|
|
1645
1645
|
};
|
1646
1646
|
}());
|
1647
1647
|
|
1648
|
-
var Enumerator = Rx.internals.Enumerator = function (next) {
|
1649
|
-
this._next = next;
|
1650
|
-
};
|
1651
|
-
|
1652
|
-
Enumerator.prototype.next = function () {
|
1653
|
-
return this._next();
|
1654
|
-
};
|
1655
|
-
|
1656
|
-
Enumerator.prototype[$iterator$] = function () { return this; }
|
1657
|
-
|
1658
|
-
var Enumerable = Rx.internals.Enumerable = function (iterator) {
|
1659
|
-
this._iterator = iterator;
|
1660
|
-
};
|
1661
|
-
|
1662
|
-
Enumerable.prototype[$iterator$] = function () {
|
1663
|
-
return this._iterator();
|
1664
|
-
};
|
1665
|
-
|
1666
|
-
Enumerable.prototype.concat = function () {
|
1667
|
-
var sources = this;
|
1668
|
-
return new AnonymousObservable(function (observer) {
|
1669
|
-
var e;
|
1670
|
-
try {
|
1671
|
-
e = sources[$iterator$]();
|
1672
|
-
} catch(err) {
|
1673
|
-
observer.onError();
|
1674
|
-
return;
|
1675
|
-
}
|
1676
|
-
|
1677
|
-
var isDisposed,
|
1678
|
-
subscription = new SerialDisposable();
|
1679
|
-
var cancelable = immediateScheduler.scheduleRecursive(function (self) {
|
1680
|
-
var currentItem;
|
1681
|
-
if (isDisposed) { return; }
|
1682
|
-
|
1683
|
-
try {
|
1684
|
-
currentItem = e.next();
|
1685
|
-
} catch (ex) {
|
1686
|
-
observer.onError(ex);
|
1687
|
-
return;
|
1688
|
-
}
|
1689
|
-
|
1690
|
-
if (currentItem.done) {
|
1691
|
-
observer.onCompleted();
|
1692
|
-
return;
|
1693
|
-
}
|
1694
|
-
|
1695
|
-
// Check if promise
|
1696
|
-
var currentValue = currentItem.value;
|
1697
|
-
isPromise(currentValue) && (currentValue = observableFromPromise(currentValue));
|
1698
|
-
|
1699
|
-
var d = new SingleAssignmentDisposable();
|
1700
|
-
subscription.setDisposable(d);
|
1701
|
-
d.setDisposable(currentValue.subscribe(
|
1702
|
-
observer.onNext.bind(observer),
|
1703
|
-
observer.onError.bind(observer),
|
1704
|
-
function () { self(); })
|
1705
|
-
);
|
1706
|
-
});
|
1707
|
-
|
1708
|
-
return new CompositeDisposable(subscription, cancelable, disposableCreate(function () {
|
1709
|
-
isDisposed = true;
|
1710
|
-
}));
|
1711
|
-
});
|
1712
|
-
};
|
1713
|
-
|
1714
|
-
Enumerable.prototype.catchException = function () {
|
1715
|
-
var sources = this;
|
1716
|
-
return new AnonymousObservable(function (observer) {
|
1717
|
-
var e;
|
1718
|
-
try {
|
1719
|
-
e = sources[$iterator$]();
|
1720
|
-
} catch(err) {
|
1721
|
-
observer.onError();
|
1722
|
-
return;
|
1723
|
-
}
|
1724
|
-
|
1725
|
-
var isDisposed,
|
1726
|
-
lastException,
|
1727
|
-
subscription = new SerialDisposable();
|
1728
|
-
var cancelable = immediateScheduler.scheduleRecursive(function (self) {
|
1729
|
-
if (isDisposed) { return; }
|
1730
|
-
|
1731
|
-
var currentItem;
|
1732
|
-
try {
|
1733
|
-
currentItem = e.next();
|
1734
|
-
} catch (ex) {
|
1735
|
-
observer.onError(ex);
|
1736
|
-
return;
|
1737
|
-
}
|
1738
|
-
|
1739
|
-
if (currentItem.done) {
|
1740
|
-
if (lastException) {
|
1741
|
-
observer.onError(lastException);
|
1742
|
-
} else {
|
1743
|
-
observer.onCompleted();
|
1744
|
-
}
|
1745
|
-
return;
|
1746
|
-
}
|
1747
|
-
|
1748
|
-
// Check if promise
|
1749
|
-
var currentValue = currentItem.value;
|
1750
|
-
isPromise(currentValue) && (currentValue = observableFromPromise(currentValue));
|
1751
|
-
|
1752
|
-
var d = new SingleAssignmentDisposable();
|
1753
|
-
subscription.setDisposable(d);
|
1754
|
-
d.setDisposable(currentValue.subscribe(
|
1755
|
-
observer.onNext.bind(observer),
|
1756
|
-
function (exn) {
|
1757
|
-
lastException = exn;
|
1758
|
-
self();
|
1759
|
-
},
|
1760
|
-
observer.onCompleted.bind(observer)));
|
1761
|
-
});
|
1762
|
-
return new CompositeDisposable(subscription, cancelable, disposableCreate(function () {
|
1763
|
-
isDisposed = true;
|
1764
|
-
}));
|
1765
|
-
});
|
1766
|
-
};
|
1767
|
-
|
1768
|
-
|
1769
|
-
var enumerableRepeat = Enumerable.repeat = function (value, repeatCount) {
|
1770
|
-
if (repeatCount == null) { repeatCount = -1; }
|
1771
|
-
return new Enumerable(function () {
|
1772
|
-
var left = repeatCount;
|
1773
|
-
return new Enumerator(function () {
|
1774
|
-
if (left === 0) { return doneEnumerator; }
|
1775
|
-
if (left > 0) { left--; }
|
1776
|
-
return { done: false, value: value };
|
1777
|
-
});
|
1778
|
-
});
|
1779
|
-
};
|
1780
|
-
|
1781
|
-
var enumerableFor = Enumerable.forEach = function (source, selector, thisArg) {
|
1782
|
-
selector || (selector = identity);
|
1783
|
-
return new Enumerable(function () {
|
1784
|
-
var index = -1;
|
1785
|
-
return new Enumerator(
|
1786
|
-
function () {
|
1787
|
-
return ++index < source.length ?
|
1788
|
-
{ done: false, value: selector.call(thisArg, source[index], index, source) } :
|
1789
|
-
doneEnumerator;
|
1790
|
-
});
|
1791
|
-
});
|
1792
|
-
};
|
1648
|
+
var Enumerator = Rx.internals.Enumerator = function (next) {
|
1649
|
+
this._next = next;
|
1650
|
+
};
|
1793
1651
|
|
1794
|
-
|
1795
|
-
|
1796
|
-
|
1797
|
-
var Observer = Rx.Observer = function () { };
|
1652
|
+
Enumerator.prototype.next = function () {
|
1653
|
+
return this._next();
|
1654
|
+
};
|
1798
1655
|
|
1799
|
-
|
1800
|
-
* Creates a notification callback from an observer.
|
1801
|
-
*
|
1802
|
-
* @param observer Observer object.
|
1803
|
-
* @returns The action that forwards its input notification to the underlying observer.
|
1804
|
-
*/
|
1805
|
-
Observer.prototype.toNotifier = function () {
|
1806
|
-
var observer = this;
|
1807
|
-
return function (n) {
|
1808
|
-
return n.accept(observer);
|
1809
|
-
};
|
1810
|
-
};
|
1656
|
+
Enumerator.prototype[$iterator$] = function () { return this; }
|
1811
1657
|
|
1812
|
-
|
1813
|
-
|
1658
|
+
var Enumerable = Rx.internals.Enumerable = function (iterator) {
|
1659
|
+
this._iterator = iterator;
|
1660
|
+
};
|
1814
1661
|
|
1815
|
-
|
1816
|
-
|
1817
|
-
|
1818
|
-
return new AnonymousObserver(this.onNext.bind(this), this.onError.bind(this), this.onCompleted.bind(this));
|
1819
|
-
};
|
1662
|
+
Enumerable.prototype[$iterator$] = function () {
|
1663
|
+
return this._iterator();
|
1664
|
+
};
|
1820
1665
|
|
1821
|
-
|
1822
|
-
|
1823
|
-
|
1824
|
-
|
1825
|
-
|
1826
|
-
|
1827
|
-
|
1666
|
+
Enumerable.prototype.concat = function () {
|
1667
|
+
var sources = this;
|
1668
|
+
return new AnonymousObservable(function (observer) {
|
1669
|
+
var e;
|
1670
|
+
try {
|
1671
|
+
e = sources[$iterator$]();
|
1672
|
+
} catch(err) {
|
1673
|
+
observer.onError();
|
1674
|
+
return;
|
1675
|
+
}
|
1828
1676
|
|
1829
|
-
|
1830
|
-
|
1831
|
-
|
1832
|
-
|
1833
|
-
|
1834
|
-
* @param {Function} [onNext] Observer's OnNext action implementation.
|
1835
|
-
* @param {Function} [onError] Observer's OnError action implementation.
|
1836
|
-
* @param {Function} [onCompleted] Observer's OnCompleted action implementation.
|
1837
|
-
* @returns {Observer} The observer object implemented using the given actions.
|
1838
|
-
*/
|
1839
|
-
var observerCreate = Observer.create = function (onNext, onError, onCompleted) {
|
1840
|
-
onNext || (onNext = noop);
|
1841
|
-
onError || (onError = defaultError);
|
1842
|
-
onCompleted || (onCompleted = noop);
|
1843
|
-
return new AnonymousObserver(onNext, onError, onCompleted);
|
1844
|
-
};
|
1677
|
+
var isDisposed,
|
1678
|
+
subscription = new SerialDisposable();
|
1679
|
+
var cancelable = immediateScheduler.scheduleRecursive(function (self) {
|
1680
|
+
var currentItem;
|
1681
|
+
if (isDisposed) { return; }
|
1845
1682
|
|
1846
|
-
|
1847
|
-
|
1848
|
-
|
1849
|
-
|
1850
|
-
|
1851
|
-
|
1852
|
-
|
1853
|
-
|
1854
|
-
|
1855
|
-
|
1856
|
-
|
1857
|
-
|
1858
|
-
|
1859
|
-
|
1860
|
-
|
1683
|
+
try {
|
1684
|
+
currentItem = e.next();
|
1685
|
+
} catch (ex) {
|
1686
|
+
observer.onError(ex);
|
1687
|
+
return;
|
1688
|
+
}
|
1689
|
+
|
1690
|
+
if (currentItem.done) {
|
1691
|
+
observer.onCompleted();
|
1692
|
+
return;
|
1693
|
+
}
|
1694
|
+
|
1695
|
+
// Check if promise
|
1696
|
+
var currentValue = currentItem.value;
|
1697
|
+
isPromise(currentValue) && (currentValue = observableFromPromise(currentValue));
|
1698
|
+
|
1699
|
+
var d = new SingleAssignmentDisposable();
|
1700
|
+
subscription.setDisposable(d);
|
1701
|
+
d.setDisposable(currentValue.subscribe(
|
1702
|
+
observer.onNext.bind(observer),
|
1703
|
+
observer.onError.bind(observer),
|
1704
|
+
function () { self(); })
|
1705
|
+
);
|
1706
|
+
});
|
1707
|
+
|
1708
|
+
return new CompositeDisposable(subscription, cancelable, disposableCreate(function () {
|
1709
|
+
isDisposed = true;
|
1710
|
+
}));
|
1711
|
+
});
|
1712
|
+
};
|
1713
|
+
|
1714
|
+
Enumerable.prototype.catchException = function () {
|
1715
|
+
var sources = this;
|
1716
|
+
return new AnonymousObservable(function (observer) {
|
1717
|
+
var e;
|
1718
|
+
try {
|
1719
|
+
e = sources[$iterator$]();
|
1720
|
+
} catch(err) {
|
1721
|
+
observer.onError();
|
1722
|
+
return;
|
1723
|
+
}
|
1724
|
+
|
1725
|
+
var isDisposed,
|
1726
|
+
lastException,
|
1727
|
+
subscription = new SerialDisposable();
|
1728
|
+
var cancelable = immediateScheduler.scheduleRecursive(function (self) {
|
1729
|
+
if (isDisposed) { return; }
|
1730
|
+
|
1731
|
+
var currentItem;
|
1732
|
+
try {
|
1733
|
+
currentItem = e.next();
|
1734
|
+
} catch (ex) {
|
1735
|
+
observer.onError(ex);
|
1736
|
+
return;
|
1737
|
+
}
|
1738
|
+
|
1739
|
+
if (currentItem.done) {
|
1740
|
+
if (lastException) {
|
1741
|
+
observer.onError(lastException);
|
1742
|
+
} else {
|
1743
|
+
observer.onCompleted();
|
1744
|
+
}
|
1745
|
+
return;
|
1746
|
+
}
|
1747
|
+
|
1748
|
+
// Check if promise
|
1749
|
+
var currentValue = currentItem.value;
|
1750
|
+
isPromise(currentValue) && (currentValue = observableFromPromise(currentValue));
|
1751
|
+
|
1752
|
+
var d = new SingleAssignmentDisposable();
|
1753
|
+
subscription.setDisposable(d);
|
1754
|
+
d.setDisposable(currentValue.subscribe(
|
1755
|
+
observer.onNext.bind(observer),
|
1756
|
+
function (exn) {
|
1757
|
+
lastException = exn;
|
1758
|
+
self();
|
1759
|
+
},
|
1760
|
+
observer.onCompleted.bind(observer)));
|
1761
|
+
});
|
1762
|
+
return new CompositeDisposable(subscription, cancelable, disposableCreate(function () {
|
1763
|
+
isDisposed = true;
|
1764
|
+
}));
|
1765
|
+
});
|
1766
|
+
};
|
1767
|
+
|
1768
|
+
var enumerableRepeat = Enumerable.repeat = function (value, repeatCount) {
|
1769
|
+
if (repeatCount == null) { repeatCount = -1; }
|
1770
|
+
return new Enumerable(function () {
|
1771
|
+
var left = repeatCount;
|
1772
|
+
return new Enumerator(function () {
|
1773
|
+
if (left === 0) { return doneEnumerator; }
|
1774
|
+
if (left > 0) { left--; }
|
1775
|
+
return { done: false, value: value };
|
1776
|
+
});
|
1777
|
+
});
|
1778
|
+
};
|
1779
|
+
|
1780
|
+
var enumerableFor = Enumerable.forEach = function (source, selector, thisArg) {
|
1781
|
+
selector || (selector = identity);
|
1782
|
+
return new Enumerable(function () {
|
1783
|
+
var index = -1;
|
1784
|
+
return new Enumerator(
|
1785
|
+
function () {
|
1786
|
+
return ++index < source.length ?
|
1787
|
+
{ done: false, value: selector.call(thisArg, source[index], index, source) } :
|
1788
|
+
doneEnumerator;
|
1861
1789
|
});
|
1862
|
-
};
|
1790
|
+
});
|
1791
|
+
};
|
1863
1792
|
|
1864
|
-
|
1865
|
-
|
1866
|
-
|
1867
|
-
|
1868
|
-
|
1869
|
-
|
1870
|
-
|
1793
|
+
/**
|
1794
|
+
* Supports push-style iteration over an observable sequence.
|
1795
|
+
*/
|
1796
|
+
var Observer = Rx.Observer = function () { };
|
1797
|
+
|
1798
|
+
/**
|
1799
|
+
* Creates a notification callback from an observer.
|
1800
|
+
*
|
1801
|
+
* @param observer Observer object.
|
1802
|
+
* @returns The action that forwards its input notification to the underlying observer.
|
1803
|
+
*/
|
1804
|
+
Observer.prototype.toNotifier = function () {
|
1805
|
+
var observer = this;
|
1806
|
+
return function (n) {
|
1807
|
+
return n.accept(observer);
|
1871
1808
|
};
|
1872
|
-
|
1809
|
+
};
|
1810
|
+
|
1811
|
+
/**
|
1812
|
+
* Hides the identity of an observer.
|
1813
|
+
|
1814
|
+
* @returns An observer that hides the identity of the specified observer.
|
1815
|
+
*/
|
1816
|
+
Observer.prototype.asObserver = function () {
|
1817
|
+
return new AnonymousObserver(this.onNext.bind(this), this.onError.bind(this), this.onCompleted.bind(this));
|
1818
|
+
};
|
1819
|
+
|
1820
|
+
/**
|
1821
|
+
* Checks access to the observer for grammar violations. This includes checking for multiple OnError or OnCompleted calls, as well as reentrancy in any of the observer methods.
|
1822
|
+
* If a violation is detected, an Error is thrown from the offending observer method call.
|
1823
|
+
*
|
1824
|
+
* @returns An observer that checks callbacks invocations against the observer grammar and, if the checks pass, forwards those to the specified observer.
|
1825
|
+
*/
|
1826
|
+
Observer.prototype.checked = function () { return new CheckedObserver(this); };
|
1827
|
+
|
1828
|
+
/**
|
1829
|
+
* Creates an observer from the specified OnNext, along with optional OnError, and OnCompleted actions.
|
1830
|
+
*
|
1831
|
+
* @static
|
1832
|
+
* @memberOf Observer
|
1833
|
+
* @param {Function} [onNext] Observer's OnNext action implementation.
|
1834
|
+
* @param {Function} [onError] Observer's OnError action implementation.
|
1835
|
+
* @param {Function} [onCompleted] Observer's OnCompleted action implementation.
|
1836
|
+
* @returns {Observer} The observer object implemented using the given actions.
|
1837
|
+
*/
|
1838
|
+
var observerCreate = Observer.create = function (onNext, onError, onCompleted) {
|
1839
|
+
onNext || (onNext = noop);
|
1840
|
+
onError || (onError = defaultError);
|
1841
|
+
onCompleted || (onCompleted = noop);
|
1842
|
+
return new AnonymousObserver(onNext, onError, onCompleted);
|
1843
|
+
};
|
1844
|
+
|
1845
|
+
/**
|
1846
|
+
* Creates an observer from a notification callback.
|
1847
|
+
*
|
1848
|
+
* @static
|
1849
|
+
* @memberOf Observer
|
1850
|
+
* @param {Function} handler Action that handles a notification.
|
1851
|
+
* @returns The observer object that invokes the specified handler using a notification corresponding to each message it receives.
|
1852
|
+
*/
|
1853
|
+
Observer.fromNotifier = function (handler) {
|
1854
|
+
return new AnonymousObserver(function (x) {
|
1855
|
+
return handler(notificationCreateOnNext(x));
|
1856
|
+
}, function (exception) {
|
1857
|
+
return handler(notificationCreateOnError(exception));
|
1858
|
+
}, function () {
|
1859
|
+
return handler(notificationCreateOnCompleted());
|
1860
|
+
});
|
1861
|
+
};
|
1862
|
+
|
1863
|
+
/**
|
1864
|
+
* Schedules the invocation of observer methods on the given scheduler.
|
1865
|
+
* @param {Scheduler} scheduler Scheduler to schedule observer messages on.
|
1866
|
+
* @returns {Observer} Observer whose messages are scheduled on the given scheduler.
|
1867
|
+
*/
|
1868
|
+
Observer.notifyOn = function (scheduler) {
|
1869
|
+
return new ObserveOnObserver(scheduler, this);
|
1870
|
+
};
|
1871
|
+
|
1873
1872
|
/**
|
1874
1873
|
* Abstract base class for implementations of the Observer class.
|
1875
1874
|
* This base class enforces the grammar of observers where OnError and OnCompleted are terminal messages.
|
@@ -2139,83 +2138,43 @@
|
|
2139
2138
|
return ObserveOnObserver;
|
2140
2139
|
})(ScheduledObserver);
|
2141
2140
|
|
2142
|
-
|
2143
|
-
|
2144
|
-
/**
|
2145
|
-
* Represents a push-style collection.
|
2146
|
-
*/
|
2147
|
-
var Observable = Rx.Observable = (function () {
|
2148
|
-
|
2149
|
-
/**
|
2150
|
-
* @constructor
|
2151
|
-
* @private
|
2152
|
-
*/
|
2153
|
-
function Observable(subscribe) {
|
2154
|
-
this._subscribe = subscribe;
|
2155
|
-
}
|
2141
|
+
var observableProto;
|
2156
2142
|
|
2157
|
-
|
2143
|
+
/**
|
2144
|
+
* Represents a push-style collection.
|
2145
|
+
*/
|
2146
|
+
var Observable = Rx.Observable = (function () {
|
2158
2147
|
|
2159
|
-
|
2160
|
-
|
2161
|
-
|
2162
|
-
var hasValue = false, value;
|
2163
|
-
return source.subscribe(function (x) {
|
2164
|
-
hasValue = true;
|
2165
|
-
value = x;
|
2166
|
-
}, observer.onError.bind(observer), function () {
|
2167
|
-
if (!hasValue) {
|
2168
|
-
observer.onError(new Error(sequenceContainsNoElements));
|
2169
|
-
} else {
|
2170
|
-
observer.onNext(value);
|
2171
|
-
observer.onCompleted();
|
2172
|
-
}
|
2173
|
-
});
|
2174
|
-
});
|
2175
|
-
};
|
2148
|
+
function Observable(subscribe) {
|
2149
|
+
this._subscribe = subscribe;
|
2150
|
+
}
|
2176
2151
|
|
2177
|
-
|
2178
|
-
* Subscribes an observer to the observable sequence.
|
2179
|
-
*
|
2180
|
-
* @example
|
2181
|
-
* 1 - source.subscribe();
|
2182
|
-
* 2 - source.subscribe(observer);
|
2183
|
-
* 3 - source.subscribe(function (x) { console.log(x); });
|
2184
|
-
* 4 - source.subscribe(function (x) { console.log(x); }, function (err) { console.log(err); });
|
2185
|
-
* 5 - source.subscribe(function (x) { console.log(x); }, function (err) { console.log(err); }, function () { console.log('done'); });
|
2186
|
-
* @param {Mixed} [observerOrOnNext] The object that is to receive notifications or an action to invoke for each element in the observable sequence.
|
2187
|
-
* @param {Function} [onError] Action to invoke upon exceptional termination of the observable sequence.
|
2188
|
-
* @param {Function} [onCompleted] Action to invoke upon graceful termination of the observable sequence.
|
2189
|
-
* @returns {Diposable} The source sequence whose subscriptions and unsubscriptions happen on the specified scheduler.
|
2190
|
-
*/
|
2191
|
-
observableProto.subscribe = observableProto.forEach = function (observerOrOnNext, onError, onCompleted) {
|
2192
|
-
var subscriber;
|
2193
|
-
if (typeof observerOrOnNext === 'object') {
|
2194
|
-
subscriber = observerOrOnNext;
|
2195
|
-
} else {
|
2196
|
-
subscriber = observerCreate(observerOrOnNext, onError, onCompleted);
|
2197
|
-
}
|
2152
|
+
observableProto = Observable.prototype;
|
2198
2153
|
|
2199
|
-
|
2200
|
-
|
2154
|
+
/**
|
2155
|
+
* Subscribes an observer to the observable sequence.
|
2156
|
+
*
|
2157
|
+
* @example
|
2158
|
+
* 1 - source.subscribe();
|
2159
|
+
* 2 - source.subscribe(observer);
|
2160
|
+
* 3 - source.subscribe(function (x) { console.log(x); });
|
2161
|
+
* 4 - source.subscribe(function (x) { console.log(x); }, function (err) { console.log(err); });
|
2162
|
+
* 5 - source.subscribe(function (x) { console.log(x); }, function (err) { console.log(err); }, function () { console.log('done'); });
|
2163
|
+
* @param {Mixed} [observerOrOnNext] The object that is to receive notifications or an action to invoke for each element in the observable sequence.
|
2164
|
+
* @param {Function} [onError] Action to invoke upon exceptional termination of the observable sequence.
|
2165
|
+
* @param {Function} [onCompleted] Action to invoke upon graceful termination of the observable sequence.
|
2166
|
+
* @returns {Diposable} The source sequence whose subscriptions and unsubscriptions happen on the specified scheduler.
|
2167
|
+
*/
|
2168
|
+
observableProto.subscribe = observableProto.forEach = function (observerOrOnNext, onError, onCompleted) {
|
2169
|
+
var subscriber = typeof observerOrOnNext === 'object' ?
|
2170
|
+
observerOrOnNext :
|
2171
|
+
observerCreate(observerOrOnNext, onError, onCompleted);
|
2201
2172
|
|
2202
|
-
|
2203
|
-
|
2204
|
-
*
|
2205
|
-
* @memberOf Observable
|
2206
|
-
* @returns An observable sequence containing a single element with a list containing all the elements of the source sequence.
|
2207
|
-
*/
|
2208
|
-
observableProto.toArray = function () {
|
2209
|
-
function accumulator(list, i) {
|
2210
|
-
var newList = list.slice(0);
|
2211
|
-
newList.push(i);
|
2212
|
-
return newList;
|
2213
|
-
}
|
2214
|
-
return this.scan([], accumulator).startWith([]).finalValue();
|
2215
|
-
};
|
2173
|
+
return this._subscribe(subscriber);
|
2174
|
+
};
|
2216
2175
|
|
2217
|
-
|
2218
|
-
|
2176
|
+
return Observable;
|
2177
|
+
})();
|
2219
2178
|
|
2220
2179
|
/**
|
2221
2180
|
* Wraps the source sequence in order to run its observer callbacks on the specified scheduler.
|
@@ -2310,6 +2269,24 @@
|
|
2310
2269
|
});
|
2311
2270
|
});
|
2312
2271
|
};
|
2272
|
+
/**
|
2273
|
+
* Creates a list from an observable sequence.
|
2274
|
+
* @returns An observable sequence containing a single element with a list containing all the elements of the source sequence.
|
2275
|
+
*/
|
2276
|
+
observableProto.toArray = function () {
|
2277
|
+
var self = this;
|
2278
|
+
return new AnonymousObservable(function(observer) {
|
2279
|
+
var arr = [];
|
2280
|
+
return self.subscribe(
|
2281
|
+
arr.push.bind(arr),
|
2282
|
+
observer.onError.bind(observer),
|
2283
|
+
function () {
|
2284
|
+
observer.onNext(arr);
|
2285
|
+
observer.onCompleted();
|
2286
|
+
});
|
2287
|
+
});
|
2288
|
+
};
|
2289
|
+
|
2313
2290
|
/**
|
2314
2291
|
* Creates an observable sequence from a specified subscribe method implementation.
|
2315
2292
|
*
|
@@ -2567,30 +2544,30 @@
|
|
2567
2544
|
});
|
2568
2545
|
};
|
2569
2546
|
|
2570
|
-
|
2571
|
-
|
2572
|
-
|
2573
|
-
|
2574
|
-
|
2575
|
-
|
2576
|
-
|
2577
|
-
|
2578
|
-
|
2579
|
-
|
2580
|
-
|
2581
|
-
|
2582
|
-
|
2583
|
-
|
2584
|
-
|
2585
|
-
|
2586
|
-
|
2587
|
-
|
2588
|
-
|
2589
|
-
|
2590
|
-
|
2591
|
-
|
2592
|
-
|
2593
|
-
|
2547
|
+
/**
|
2548
|
+
* Constructs an observable sequence that depends on a resource object, whose lifetime is tied to the resulting observable sequence's lifetime.
|
2549
|
+
*
|
2550
|
+
* @example
|
2551
|
+
* var res = Rx.Observable.using(function () { return new AsyncSubject(); }, function (s) { return s; });
|
2552
|
+
* @param {Function} resourceFactory Factory function to obtain a resource object.
|
2553
|
+
* @param {Function} observableFactory Factory function to obtain an observable sequence that depends on the obtained resource.
|
2554
|
+
* @returns {Observable} An observable sequence whose lifetime controls the lifetime of the dependent resource object.
|
2555
|
+
*/
|
2556
|
+
Observable.using = function (resourceFactory, observableFactory) {
|
2557
|
+
return new AnonymousObservable(function (observer) {
|
2558
|
+
var disposable = disposableEmpty, resource, source;
|
2559
|
+
try {
|
2560
|
+
resource = resourceFactory();
|
2561
|
+
if (resource) {
|
2562
|
+
disposable = resource;
|
2563
|
+
}
|
2564
|
+
source = observableFactory(resource);
|
2565
|
+
} catch (exception) {
|
2566
|
+
return new CompositeDisposable(observableThrow(exception).subscribe(observer), disposable);
|
2567
|
+
}
|
2568
|
+
return new CompositeDisposable(source.subscribe(observer), disposable);
|
2569
|
+
});
|
2570
|
+
};
|
2594
2571
|
|
2595
2572
|
/**
|
2596
2573
|
* Propagates the observable sequence or Promise that reacts first.
|
@@ -3013,37 +2990,35 @@
|
|
3013
2990
|
});
|
3014
2991
|
};
|
3015
2992
|
|
3016
|
-
|
3017
|
-
|
3018
|
-
|
3019
|
-
|
3020
|
-
|
3021
|
-
|
3022
|
-
|
3023
|
-
|
3024
|
-
|
3025
|
-
|
3026
|
-
|
3027
|
-
|
3028
|
-
|
3029
|
-
|
3030
|
-
if (isOpen) {
|
3031
|
-
observer.onCompleted();
|
3032
|
-
}
|
3033
|
-
}));
|
2993
|
+
/**
|
2994
|
+
* Returns the values from the source observable sequence only after the other observable sequence produces a value.
|
2995
|
+
* @param {Observable | Promise} other The observable sequence or Promise that triggers propagation of elements of the source sequence.
|
2996
|
+
* @returns {Observable} An observable sequence containing the elements of the source sequence starting from the point the other sequence triggered propagation.
|
2997
|
+
*/
|
2998
|
+
observableProto.skipUntil = function (other) {
|
2999
|
+
var source = this;
|
3000
|
+
return new AnonymousObservable(function (observer) {
|
3001
|
+
var isOpen = false;
|
3002
|
+
var disposables = new CompositeDisposable(source.subscribe(function (left) {
|
3003
|
+
isOpen && observer.onNext(left);
|
3004
|
+
}, observer.onError.bind(observer), function () {
|
3005
|
+
isOpen && observer.onCompleted();
|
3006
|
+
}));
|
3034
3007
|
|
3035
|
-
|
3036
|
-
disposables.add(rightSubscription);
|
3037
|
-
rightSubscription.setDisposable(other.subscribe(function () {
|
3038
|
-
isOpen = true;
|
3039
|
-
rightSubscription.dispose();
|
3040
|
-
}, observer.onError.bind(observer), function () {
|
3041
|
-
rightSubscription.dispose();
|
3042
|
-
}));
|
3008
|
+
isPromise(other) && (other = observableFromPromise(other));
|
3043
3009
|
|
3044
|
-
|
3045
|
-
|
3046
|
-
|
3010
|
+
var rightSubscription = new SingleAssignmentDisposable();
|
3011
|
+
disposables.add(rightSubscription);
|
3012
|
+
rightSubscription.setDisposable(other.subscribe(function () {
|
3013
|
+
isOpen = true;
|
3014
|
+
rightSubscription.dispose();
|
3015
|
+
}, observer.onError.bind(observer), function () {
|
3016
|
+
rightSubscription.dispose();
|
3017
|
+
}));
|
3018
|
+
|
3019
|
+
return disposables;
|
3020
|
+
});
|
3021
|
+
};
|
3047
3022
|
|
3048
3023
|
/**
|
3049
3024
|
* Transforms an observable sequence of observable sequences into an observable sequence producing values only from the most recent observable sequence.
|
@@ -3092,20 +3067,21 @@
|
|
3092
3067
|
});
|
3093
3068
|
};
|
3094
3069
|
|
3095
|
-
|
3096
|
-
|
3097
|
-
|
3098
|
-
|
3099
|
-
|
3100
|
-
|
3101
|
-
|
3102
|
-
|
3103
|
-
|
3104
|
-
|
3105
|
-
|
3106
|
-
|
3107
|
-
|
3108
|
-
};
|
3070
|
+
/**
|
3071
|
+
* Returns the values from the source observable sequence until the other observable sequence produces a value.
|
3072
|
+
* @param {Observable | Promise} other Observable sequence or Promise that terminates propagation of elements of the source sequence.
|
3073
|
+
* @returns {Observable} An observable sequence containing the elements of the source sequence up to the point the other sequence interrupted further propagation.
|
3074
|
+
*/
|
3075
|
+
observableProto.takeUntil = function (other) {
|
3076
|
+
var source = this;
|
3077
|
+
return new AnonymousObservable(function (observer) {
|
3078
|
+
isPromise(other) && (other = observableFromPromise(other));
|
3079
|
+
return new CompositeDisposable(
|
3080
|
+
source.subscribe(observer),
|
3081
|
+
other.subscribe(observer.onCompleted.bind(observer), observer.onError.bind(observer), noop)
|
3082
|
+
);
|
3083
|
+
});
|
3084
|
+
};
|
3109
3085
|
|
3110
3086
|
function zipArray(second, resultSelector) {
|
3111
3087
|
var first = this;
|
@@ -3265,26 +3241,26 @@
|
|
3265
3241
|
});
|
3266
3242
|
};
|
3267
3243
|
|
3268
|
-
|
3269
|
-
|
3270
|
-
|
3271
|
-
|
3272
|
-
|
3273
|
-
|
3274
|
-
|
3275
|
-
|
3276
|
-
|
3277
|
-
|
3278
|
-
|
3279
|
-
|
3280
|
-
|
3281
|
-
|
3282
|
-
|
3283
|
-
|
3284
|
-
|
3285
|
-
|
3286
|
-
|
3287
|
-
|
3244
|
+
/**
|
3245
|
+
* Projects each element of an observable sequence into zero or more buffers which are produced based on element count information.
|
3246
|
+
*
|
3247
|
+
* @example
|
3248
|
+
* var res = xs.bufferWithCount(10);
|
3249
|
+
* var res = xs.bufferWithCount(10, 1);
|
3250
|
+
* @param {Number} count Length of each buffer.
|
3251
|
+
* @param {Number} [skip] Number of elements to skip between creation of consecutive buffers. If not provided, defaults to the count.
|
3252
|
+
* @returns {Observable} An observable sequence of buffers.
|
3253
|
+
*/
|
3254
|
+
observableProto.bufferWithCount = function (count, skip) {
|
3255
|
+
if (typeof skip !== 'number') {
|
3256
|
+
skip = count;
|
3257
|
+
}
|
3258
|
+
return this.windowWithCount(count, skip).selectMany(function (x) {
|
3259
|
+
return x.toArray();
|
3260
|
+
}).where(function (x) {
|
3261
|
+
return x.length > 0;
|
3262
|
+
});
|
3263
|
+
};
|
3288
3264
|
|
3289
3265
|
/**
|
3290
3266
|
* Dematerializes the explicit notification values of an observable sequence as implicit notifications.
|
@@ -3398,29 +3374,35 @@
|
|
3398
3374
|
});
|
3399
3375
|
};
|
3400
3376
|
|
3401
|
-
|
3402
|
-
|
3403
|
-
|
3404
|
-
|
3405
|
-
|
3406
|
-
|
3407
|
-
|
3408
|
-
|
3409
|
-
|
3410
|
-
|
3411
|
-
|
3412
|
-
|
3413
|
-
|
3414
|
-
|
3415
|
-
|
3416
|
-
|
3417
|
-
|
3418
|
-
|
3419
|
-
|
3420
|
-
|
3421
|
-
|
3422
|
-
})
|
3423
|
-
|
3377
|
+
/**
|
3378
|
+
* Invokes a specified action after the source observable sequence terminates gracefully or exceptionally.
|
3379
|
+
*
|
3380
|
+
* @example
|
3381
|
+
* var res = observable.finallyAction(function () { console.log('sequence ended'; });
|
3382
|
+
* @param {Function} finallyAction Action to invoke after the source observable sequence terminates.
|
3383
|
+
* @returns {Observable} Source sequence with the action-invoking termination behavior applied.
|
3384
|
+
*/
|
3385
|
+
observableProto['finally'] = observableProto.finallyAction = function (action) {
|
3386
|
+
var source = this;
|
3387
|
+
return new AnonymousObservable(function (observer) {
|
3388
|
+
var subscription;
|
3389
|
+
try {
|
3390
|
+
subscription = source.subscribe(observer);
|
3391
|
+
} catch (e) {
|
3392
|
+
action();
|
3393
|
+
throw e;
|
3394
|
+
}
|
3395
|
+
return disposableCreate(function () {
|
3396
|
+
try {
|
3397
|
+
subscription.dispose();
|
3398
|
+
} catch (e) {
|
3399
|
+
throw e;
|
3400
|
+
} finally {
|
3401
|
+
action();
|
3402
|
+
}
|
3403
|
+
});
|
3404
|
+
});
|
3405
|
+
};
|
3424
3406
|
|
3425
3407
|
/**
|
3426
3408
|
* Ignores all elements in an observable sequence leaving only the termination messages.
|
@@ -3675,6 +3657,71 @@
|
|
3675
3657
|
});
|
3676
3658
|
};
|
3677
3659
|
|
3660
|
+
function concatMap(selector) {
|
3661
|
+
return this.map(function (x, i) {
|
3662
|
+
var result = selector(x, i);
|
3663
|
+
return isPromise(result) ? observableFromPromise(result) : result;
|
3664
|
+
}).concatAll();
|
3665
|
+
}
|
3666
|
+
|
3667
|
+
function concatMapObserver(onNext, onError, onCompleted) {
|
3668
|
+
var source = this;
|
3669
|
+
return new AnonymousObservable(function (observer) {
|
3670
|
+
var index = 0;
|
3671
|
+
|
3672
|
+
return source.subscribe(
|
3673
|
+
function (x) {
|
3674
|
+
observer.onNext(onNext(x, index++));
|
3675
|
+
},
|
3676
|
+
function (err) {
|
3677
|
+
observer.onNext(onError(err));
|
3678
|
+
observer.completed();
|
3679
|
+
},
|
3680
|
+
function () {
|
3681
|
+
observer.onNext(onCompleted());
|
3682
|
+
observer.onCompleted();
|
3683
|
+
});
|
3684
|
+
}).concatAll();
|
3685
|
+
}
|
3686
|
+
|
3687
|
+
/**
|
3688
|
+
* One of the Following:
|
3689
|
+
* Projects each element of an observable sequence to an observable sequence and merges the resulting observable sequences into one observable sequence.
|
3690
|
+
*
|
3691
|
+
* @example
|
3692
|
+
* var res = source.selectMany(function (x) { return Rx.Observable.range(0, x); });
|
3693
|
+
* Or:
|
3694
|
+
* Projects each element of an observable sequence to an observable sequence, invokes the result selector for the source element and each of the corresponding inner sequence's elements, and merges the results into one observable sequence.
|
3695
|
+
*
|
3696
|
+
* var res = source.selectMany(function (x) { return Rx.Observable.range(0, x); }, function (x, y) { return x + y; });
|
3697
|
+
* Or:
|
3698
|
+
* Projects each element of the source observable sequence to the other observable sequence and merges the resulting observable sequences into one observable sequence.
|
3699
|
+
*
|
3700
|
+
* var res = source.selectMany(Rx.Observable.fromArray([1,2,3]));
|
3701
|
+
* @param selector A transform function to apply to each element or an observable sequence to project each element from the
|
3702
|
+
* source sequence onto which could be either an observable or Promise.
|
3703
|
+
* @param {Function} [resultSelector] A transform function to apply to each element of the intermediate sequence.
|
3704
|
+
* @returns {Observable} An observable sequence whose elements are the result of invoking the one-to-many transform function collectionSelector on each element of the input sequence and then mapping each of those sequence elements and their corresponding source element to a result element.
|
3705
|
+
*/
|
3706
|
+
observableProto.selectConcat = observableProto.concatMap = function (selector, resultSelector) {
|
3707
|
+
if (resultSelector) {
|
3708
|
+
return this.concatMap(function (x, i) {
|
3709
|
+
var selectorResult = selector(x, i),
|
3710
|
+
result = isPromise(selectorResult) ? observableFromPromise(selectorResult) : selectorResult;
|
3711
|
+
|
3712
|
+
return result.map(function (y) {
|
3713
|
+
return resultSelector(x, y, i);
|
3714
|
+
});
|
3715
|
+
});
|
3716
|
+
}
|
3717
|
+
if (typeof selector === 'function') {
|
3718
|
+
return concatMap.call(this, selector);
|
3719
|
+
}
|
3720
|
+
return concatMap.call(this, function () {
|
3721
|
+
return selector;
|
3722
|
+
});
|
3723
|
+
};
|
3724
|
+
|
3678
3725
|
/**
|
3679
3726
|
* Returns the elements of the specified sequence or the specified value in a singleton sequence if the sequence is empty.
|
3680
3727
|
*
|
@@ -3910,6 +3957,26 @@
|
|
3910
3957
|
}).mergeObservable();
|
3911
3958
|
}
|
3912
3959
|
|
3960
|
+
function selectManyObserver(onNext, onError, onCompleted) {
|
3961
|
+
var source = this;
|
3962
|
+
return new AnonymousObservable(function (observer) {
|
3963
|
+
var index = 0;
|
3964
|
+
|
3965
|
+
return source.subscribe(
|
3966
|
+
function (x) {
|
3967
|
+
observer.onNext(onNext(x, index++));
|
3968
|
+
},
|
3969
|
+
function (err) {
|
3970
|
+
observer.onNext(onError(err));
|
3971
|
+
observer.completed();
|
3972
|
+
},
|
3973
|
+
function () {
|
3974
|
+
observer.onNext(onCompleted());
|
3975
|
+
observer.onCompleted();
|
3976
|
+
});
|
3977
|
+
}).mergeAll();
|
3978
|
+
}
|
3979
|
+
|
3913
3980
|
/**
|
3914
3981
|
* One of the Following:
|
3915
3982
|
* Projects each element of an observable sequence to an observable sequence and merges the resulting observable sequences into one observable sequence.
|
@@ -4105,56 +4172,56 @@
|
|
4105
4172
|
});
|
4106
4173
|
};
|
4107
4174
|
|
4108
|
-
|
4109
|
-
|
4110
|
-
|
4111
|
-
// Fix subscriber to check for undefined or function returned to decorate as Disposable
|
4112
|
-
function fixSubscriber(subscriber) {
|
4113
|
-
if (typeof subscriber === 'undefined') {
|
4114
|
-
subscriber = disposableEmpty;
|
4115
|
-
} else if (typeof subscriber === 'function') {
|
4116
|
-
subscriber = disposableCreate(subscriber);
|
4117
|
-
}
|
4175
|
+
var AnonymousObservable = Rx.AnonymousObservable = (function (__super__) {
|
4176
|
+
inherits(AnonymousObservable, __super__);
|
4118
4177
|
|
4119
|
-
|
4120
|
-
|
4178
|
+
// Fix subscriber to check for undefined or function returned to decorate as Disposable
|
4179
|
+
function fixSubscriber(subscriber) {
|
4180
|
+
if (typeof subscriber === 'undefined') {
|
4181
|
+
subscriber = disposableEmpty;
|
4182
|
+
} else if (typeof subscriber === 'function') {
|
4183
|
+
subscriber = disposableCreate(subscriber);
|
4184
|
+
}
|
4121
4185
|
|
4122
|
-
|
4123
|
-
|
4124
|
-
return new AnonymousObservable(subscribe);
|
4125
|
-
}
|
4186
|
+
return subscriber;
|
4187
|
+
}
|
4126
4188
|
|
4127
|
-
|
4128
|
-
|
4129
|
-
|
4130
|
-
|
4131
|
-
try {
|
4132
|
-
autoDetachObserver.setDisposable(fixSubscriber(subscribe(autoDetachObserver)));
|
4133
|
-
} catch (e) {
|
4134
|
-
if (!autoDetachObserver.fail(e)) {
|
4135
|
-
throw e;
|
4136
|
-
}
|
4137
|
-
}
|
4138
|
-
});
|
4139
|
-
} else {
|
4140
|
-
try {
|
4141
|
-
autoDetachObserver.setDisposable(fixSubscriber(subscribe(autoDetachObserver)));
|
4142
|
-
} catch (e) {
|
4143
|
-
if (!autoDetachObserver.fail(e)) {
|
4144
|
-
throw e;
|
4145
|
-
}
|
4146
|
-
}
|
4147
|
-
}
|
4189
|
+
function AnonymousObservable(subscribe) {
|
4190
|
+
if (!(this instanceof AnonymousObservable)) {
|
4191
|
+
return new AnonymousObservable(subscribe);
|
4192
|
+
}
|
4148
4193
|
|
4149
|
-
|
4194
|
+
function s(observer) {
|
4195
|
+
var autoDetachObserver = new AutoDetachObserver(observer);
|
4196
|
+
if (currentThreadScheduler.scheduleRequired()) {
|
4197
|
+
currentThreadScheduler.schedule(function () {
|
4198
|
+
try {
|
4199
|
+
autoDetachObserver.setDisposable(fixSubscriber(subscribe(autoDetachObserver)));
|
4200
|
+
} catch (e) {
|
4201
|
+
if (!autoDetachObserver.fail(e)) {
|
4202
|
+
throw e;
|
4203
|
+
}
|
4150
4204
|
}
|
4151
|
-
|
4152
|
-
|
4205
|
+
});
|
4206
|
+
} else {
|
4207
|
+
try {
|
4208
|
+
autoDetachObserver.setDisposable(fixSubscriber(subscribe(autoDetachObserver)));
|
4209
|
+
} catch (e) {
|
4210
|
+
if (!autoDetachObserver.fail(e)) {
|
4211
|
+
throw e;
|
4212
|
+
}
|
4213
|
+
}
|
4153
4214
|
}
|
4154
4215
|
|
4155
|
-
return
|
4216
|
+
return autoDetachObserver;
|
4217
|
+
}
|
4156
4218
|
|
4157
|
-
|
4219
|
+
__super__.call(this, s);
|
4220
|
+
}
|
4221
|
+
|
4222
|
+
return AnonymousObservable;
|
4223
|
+
|
4224
|
+
}(Observable));
|
4158
4225
|
|
4159
4226
|
/** @private */
|
4160
4227
|
var AutoDetachObserver = (function (_super) {
|
@@ -4217,48 +4284,48 @@
|
|
4217
4284
|
return AutoDetachObserver;
|
4218
4285
|
}(AbstractObserver));
|
4219
4286
|
|
4220
|
-
/** @private */
|
4221
|
-
var GroupedObservable = (function (_super) {
|
4222
|
-
inherits(GroupedObservable, _super);
|
4223
|
-
|
4224
|
-
function subscribe(observer) {
|
4225
|
-
return this.underlyingObservable.subscribe(observer);
|
4226
|
-
}
|
4227
|
-
|
4228
|
-
/**
|
4229
|
-
* @constructor
|
4230
|
-
* @private
|
4231
|
-
*/
|
4232
|
-
function GroupedObservable(key, underlyingObservable, mergedDisposable) {
|
4233
|
-
_super.call(this, subscribe);
|
4234
|
-
this.key = key;
|
4235
|
-
this.underlyingObservable = !mergedDisposable ?
|
4236
|
-
underlyingObservable :
|
4237
|
-
new AnonymousObservable(function (observer) {
|
4238
|
-
return new CompositeDisposable(mergedDisposable.getDisposable(), underlyingObservable.subscribe(observer));
|
4239
|
-
});
|
4240
|
-
}
|
4241
|
-
|
4242
|
-
return GroupedObservable;
|
4243
|
-
}(Observable));
|
4244
|
-
|
4245
|
-
/** @private */
|
4246
|
-
var InnerSubscription = function (subject, observer) {
|
4247
|
-
this.subject = subject;
|
4248
|
-
this.observer = observer;
|
4249
|
-
};
|
4250
|
-
|
4251
|
-
/**
|
4252
|
-
* @private
|
4253
|
-
* @memberOf InnerSubscription
|
4254
|
-
*/
|
4255
|
-
InnerSubscription.prototype.dispose = function () {
|
4256
|
-
if (!this.subject.isDisposed && this.observer !== null) {
|
4257
|
-
var idx = this.subject.observers.indexOf(this.observer);
|
4258
|
-
this.subject.observers.splice(idx, 1);
|
4259
|
-
this.observer = null;
|
4260
|
-
}
|
4261
|
-
};
|
4287
|
+
/** @private */
|
4288
|
+
var GroupedObservable = (function (_super) {
|
4289
|
+
inherits(GroupedObservable, _super);
|
4290
|
+
|
4291
|
+
function subscribe(observer) {
|
4292
|
+
return this.underlyingObservable.subscribe(observer);
|
4293
|
+
}
|
4294
|
+
|
4295
|
+
/**
|
4296
|
+
* @constructor
|
4297
|
+
* @private
|
4298
|
+
*/
|
4299
|
+
function GroupedObservable(key, underlyingObservable, mergedDisposable) {
|
4300
|
+
_super.call(this, subscribe);
|
4301
|
+
this.key = key;
|
4302
|
+
this.underlyingObservable = !mergedDisposable ?
|
4303
|
+
underlyingObservable :
|
4304
|
+
new AnonymousObservable(function (observer) {
|
4305
|
+
return new CompositeDisposable(mergedDisposable.getDisposable(), underlyingObservable.subscribe(observer));
|
4306
|
+
});
|
4307
|
+
}
|
4308
|
+
|
4309
|
+
return GroupedObservable;
|
4310
|
+
}(Observable));
|
4311
|
+
|
4312
|
+
/** @private */
|
4313
|
+
var InnerSubscription = function (subject, observer) {
|
4314
|
+
this.subject = subject;
|
4315
|
+
this.observer = observer;
|
4316
|
+
};
|
4317
|
+
|
4318
|
+
/**
|
4319
|
+
* @private
|
4320
|
+
* @memberOf InnerSubscription
|
4321
|
+
*/
|
4322
|
+
InnerSubscription.prototype.dispose = function () {
|
4323
|
+
if (!this.subject.isDisposed && this.observer !== null) {
|
4324
|
+
var idx = this.subject.observers.indexOf(this.observer);
|
4325
|
+
this.subject.observers.splice(idx, 1);
|
4326
|
+
this.observer = null;
|
4327
|
+
}
|
4328
|
+
};
|
4262
4329
|
|
4263
4330
|
/**
|
4264
4331
|
* Represents an object that is both an observable sequence as well as an observer.
|
@@ -4493,66 +4560,66 @@
|
|
4493
4560
|
return AsyncSubject;
|
4494
4561
|
}(Observable));
|
4495
4562
|
|
4496
|
-
/** @private */
|
4497
|
-
var AnonymousSubject = (function (_super) {
|
4498
|
-
inherits(AnonymousSubject, _super);
|
4499
|
-
|
4500
|
-
function subscribe(observer) {
|
4501
|
-
return this.observable.subscribe(observer);
|
4502
|
-
}
|
4503
|
-
|
4504
|
-
/**
|
4505
|
-
* @private
|
4506
|
-
* @constructor
|
4507
|
-
*/
|
4508
|
-
function AnonymousSubject(observer, observable) {
|
4509
|
-
_super.call(this, subscribe);
|
4510
|
-
this.observer = observer;
|
4511
|
-
this.observable = observable;
|
4512
|
-
}
|
4513
|
-
|
4514
|
-
addProperties(AnonymousSubject.prototype, Observer, {
|
4515
|
-
/**
|
4516
|
-
* @private
|
4517
|
-
* @memberOf AnonymousSubject#
|
4518
|
-
*/
|
4519
|
-
onCompleted: function () {
|
4520
|
-
this.observer.onCompleted();
|
4521
|
-
},
|
4522
|
-
/**
|
4523
|
-
* @private
|
4524
|
-
* @memberOf AnonymousSubject#
|
4525
|
-
*/
|
4526
|
-
onError: function (exception) {
|
4527
|
-
this.observer.onError(exception);
|
4528
|
-
},
|
4529
|
-
/**
|
4530
|
-
* @private
|
4531
|
-
* @memberOf AnonymousSubject#
|
4532
|
-
*/
|
4533
|
-
onNext: function (value) {
|
4534
|
-
this.observer.onNext(value);
|
4535
|
-
}
|
4536
|
-
});
|
4537
|
-
|
4538
|
-
return AnonymousSubject;
|
4539
|
-
}(Observable));
|
4540
|
-
|
4541
|
-
if (typeof define == 'function' && typeof define.amd == 'object' && define.amd) {
|
4542
|
-
root.Rx = Rx;
|
4543
|
-
|
4544
|
-
define(function() {
|
4545
|
-
return Rx;
|
4546
|
-
});
|
4547
|
-
} else if (freeExports && freeModule) {
|
4548
|
-
// in Node.js or RingoJS
|
4549
|
-
if (moduleExports) {
|
4550
|
-
(freeModule.exports = Rx).Rx = Rx;
|
4551
|
-
} else {
|
4552
|
-
freeExports.Rx = Rx;
|
4553
|
-
}
|
4554
|
-
} else {
|
4555
|
-
// in a browser or Rhino
|
4556
|
-
root.Rx = Rx;
|
4563
|
+
/** @private */
|
4564
|
+
var AnonymousSubject = (function (_super) {
|
4565
|
+
inherits(AnonymousSubject, _super);
|
4566
|
+
|
4567
|
+
function subscribe(observer) {
|
4568
|
+
return this.observable.subscribe(observer);
|
4569
|
+
}
|
4570
|
+
|
4571
|
+
/**
|
4572
|
+
* @private
|
4573
|
+
* @constructor
|
4574
|
+
*/
|
4575
|
+
function AnonymousSubject(observer, observable) {
|
4576
|
+
_super.call(this, subscribe);
|
4577
|
+
this.observer = observer;
|
4578
|
+
this.observable = observable;
|
4579
|
+
}
|
4580
|
+
|
4581
|
+
addProperties(AnonymousSubject.prototype, Observer, {
|
4582
|
+
/**
|
4583
|
+
* @private
|
4584
|
+
* @memberOf AnonymousSubject#
|
4585
|
+
*/
|
4586
|
+
onCompleted: function () {
|
4587
|
+
this.observer.onCompleted();
|
4588
|
+
},
|
4589
|
+
/**
|
4590
|
+
* @private
|
4591
|
+
* @memberOf AnonymousSubject#
|
4592
|
+
*/
|
4593
|
+
onError: function (exception) {
|
4594
|
+
this.observer.onError(exception);
|
4595
|
+
},
|
4596
|
+
/**
|
4597
|
+
* @private
|
4598
|
+
* @memberOf AnonymousSubject#
|
4599
|
+
*/
|
4600
|
+
onNext: function (value) {
|
4601
|
+
this.observer.onNext(value);
|
4602
|
+
}
|
4603
|
+
});
|
4604
|
+
|
4605
|
+
return AnonymousSubject;
|
4606
|
+
}(Observable));
|
4607
|
+
|
4608
|
+
if (typeof define == 'function' && typeof define.amd == 'object' && define.amd) {
|
4609
|
+
root.Rx = Rx;
|
4610
|
+
|
4611
|
+
define(function() {
|
4612
|
+
return Rx;
|
4613
|
+
});
|
4614
|
+
} else if (freeExports && freeModule) {
|
4615
|
+
// in Node.js or RingoJS
|
4616
|
+
if (moduleExports) {
|
4617
|
+
(freeModule.exports = Rx).Rx = Rx;
|
4618
|
+
} else {
|
4619
|
+
freeExports.Rx = Rx;
|
4620
|
+
}
|
4621
|
+
} else {
|
4622
|
+
// in a browser or Rhino
|
4623
|
+
root.Rx = Rx;
|
4557
4624
|
}
|
4558
4625
|
}.call(this));
|