rxjs-rails 2.2.17 → 2.2.18
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/Rakefile +19 -0
- data/lib/rxjs/rails/version.rb +1 -1
- data/vendor/assets/javascripts/rx.aggregates.js +23 -23
- data/vendor/assets/javascripts/rx.aggregates.min.js +1 -1
- data/vendor/assets/javascripts/rx.async.compat.js +2 -2
- data/vendor/assets/javascripts/rx.async.compat.min.js +1 -1
- data/vendor/assets/javascripts/rx.async.js +2 -2
- data/vendor/assets/javascripts/rx.async.min.js +1 -1
- data/vendor/assets/javascripts/rx.backpressure.js +2 -2
- 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 +17 -17
- data/vendor/assets/javascripts/rx.coincidence.min.js +1 -1
- data/vendor/assets/javascripts/rx.compat.js +461 -456
- data/vendor/assets/javascripts/rx.compat.min.js +2 -2
- data/vendor/assets/javascripts/rx.experimental.js +31 -31
- data/vendor/assets/javascripts/rx.experimental.min.js +1 -1
- data/vendor/assets/javascripts/rx.joinpatterns.js +284 -284
- data/vendor/assets/javascripts/rx.joinpatterns.min.js +1 -1
- data/vendor/assets/javascripts/rx.js +446 -441
- data/vendor/assets/javascripts/rx.lite.compat.js +469 -464
- data/vendor/assets/javascripts/rx.lite.compat.min.js +2 -2
- data/vendor/assets/javascripts/rx.lite.js +469 -464
- 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 +165 -165
- data/vendor/assets/javascripts/rx.time.js +19 -19
- data/vendor/assets/javascripts/rx.time.min.js +1 -1
- data/vendor/assets/javascripts/rx.virtualtime.js +2 -2
- metadata +3 -2
@@ -1,27 +1,32 @@
|
|
1
|
-
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
|
1
|
+
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
|
2
2
|
|
3
3
|
;(function (undefined) {
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
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
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
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
|
-
|
24
|
+
var Rx = {
|
25
|
+
internals: {},
|
26
|
+
config: {
|
27
|
+
Promise: root.Promise // Detect if promise exists
|
28
|
+
}
|
29
|
+
};
|
25
30
|
|
26
31
|
// Defaults
|
27
32
|
function noop() { }
|
@@ -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,30 +869,30 @@
|
|
864
869
|
return RefCountDisposable;
|
865
870
|
})();
|
866
871
|
|
867
|
-
var ScheduledItem = Rx.internals.ScheduledItem = function (scheduler, state, action, dueTime, comparer) {
|
868
|
-
this.scheduler = scheduler;
|
869
|
-
this.state = state;
|
870
|
-
this.action = action;
|
871
|
-
this.dueTime = dueTime;
|
872
|
-
this.comparer = comparer || defaultSubComparer;
|
873
|
-
this.disposable = new SingleAssignmentDisposable();
|
874
|
-
}
|
875
|
-
|
876
|
-
ScheduledItem.prototype.invoke = function () {
|
877
|
-
this.disposable.setDisposable(this.invokeCore());
|
878
|
-
};
|
879
|
-
|
880
|
-
ScheduledItem.prototype.compareTo = function (other) {
|
881
|
-
return this.comparer(this.dueTime, other.dueTime);
|
882
|
-
};
|
883
|
-
|
884
|
-
ScheduledItem.prototype.isCancelled = function () {
|
885
|
-
return this.disposable.isDisposed;
|
886
|
-
};
|
887
|
-
|
888
|
-
ScheduledItem.prototype.invokeCore = function () {
|
889
|
-
return this.action(this.scheduler, this.state);
|
890
|
-
};
|
872
|
+
var ScheduledItem = Rx.internals.ScheduledItem = function (scheduler, state, action, dueTime, comparer) {
|
873
|
+
this.scheduler = scheduler;
|
874
|
+
this.state = state;
|
875
|
+
this.action = action;
|
876
|
+
this.dueTime = dueTime;
|
877
|
+
this.comparer = comparer || defaultSubComparer;
|
878
|
+
this.disposable = new SingleAssignmentDisposable();
|
879
|
+
}
|
880
|
+
|
881
|
+
ScheduledItem.prototype.invoke = function () {
|
882
|
+
this.disposable.setDisposable(this.invokeCore());
|
883
|
+
};
|
884
|
+
|
885
|
+
ScheduledItem.prototype.compareTo = function (other) {
|
886
|
+
return this.comparer(this.dueTime, other.dueTime);
|
887
|
+
};
|
888
|
+
|
889
|
+
ScheduledItem.prototype.isCancelled = function () {
|
890
|
+
return this.disposable.isDisposed;
|
891
|
+
};
|
892
|
+
|
893
|
+
ScheduledItem.prototype.invokeCore = function () {
|
894
|
+
return this.action(this.scheduler, this.state);
|
895
|
+
};
|
891
896
|
|
892
897
|
/** Provides a set of static properties to access commonly used schedulers. */
|
893
898
|
var Scheduler = Rx.Scheduler = (function () {
|
@@ -1142,25 +1147,25 @@
|
|
1142
1147
|
|
1143
1148
|
var normalizeTime = Scheduler.normalize;
|
1144
1149
|
|
1145
|
-
/**
|
1146
|
-
* Gets a scheduler that schedules work immediately on the current thread.
|
1147
|
-
*/
|
1148
|
-
var immediateScheduler = Scheduler.immediate = (function () {
|
1149
|
-
|
1150
|
-
function scheduleNow(state, action) { return action(this, state); }
|
1151
|
-
|
1152
|
-
function scheduleRelative(state, dueTime, action) {
|
1153
|
-
var dt = normalizeTime(dt);
|
1154
|
-
while (dt - this.now() > 0) { }
|
1155
|
-
return action(this, state);
|
1156
|
-
}
|
1157
|
-
|
1158
|
-
function scheduleAbsolute(state, dueTime, action) {
|
1159
|
-
return this.scheduleWithRelativeAndState(state, dueTime - this.now(), action);
|
1160
|
-
}
|
1161
|
-
|
1162
|
-
return new Scheduler(defaultNow, scheduleNow, scheduleRelative, scheduleAbsolute);
|
1163
|
-
}());
|
1150
|
+
/**
|
1151
|
+
* Gets a scheduler that schedules work immediately on the current thread.
|
1152
|
+
*/
|
1153
|
+
var immediateScheduler = Scheduler.immediate = (function () {
|
1154
|
+
|
1155
|
+
function scheduleNow(state, action) { return action(this, state); }
|
1156
|
+
|
1157
|
+
function scheduleRelative(state, dueTime, action) {
|
1158
|
+
var dt = normalizeTime(dt);
|
1159
|
+
while (dt - this.now() > 0) { }
|
1160
|
+
return action(this, state);
|
1161
|
+
}
|
1162
|
+
|
1163
|
+
function scheduleAbsolute(state, dueTime, action) {
|
1164
|
+
return this.scheduleWithRelativeAndState(state, dueTime - this.now(), action);
|
1165
|
+
}
|
1166
|
+
|
1167
|
+
return new Scheduler(defaultNow, scheduleNow, scheduleRelative, scheduleAbsolute);
|
1168
|
+
}());
|
1164
1169
|
|
1165
1170
|
/**
|
1166
1171
|
* Gets a scheduler that schedules work as soon as possible on the current thread.
|
@@ -1224,34 +1229,34 @@
|
|
1224
1229
|
return currentScheduler;
|
1225
1230
|
}());
|
1226
1231
|
|
1227
|
-
var SchedulePeriodicRecursive = Rx.internals.SchedulePeriodicRecursive = (function () {
|
1228
|
-
function tick(command, recurse) {
|
1229
|
-
recurse(0, this._period);
|
1230
|
-
try {
|
1231
|
-
this._state = this._action(this._state);
|
1232
|
-
} catch (e) {
|
1233
|
-
this._cancel.dispose();
|
1234
|
-
throw e;
|
1235
|
-
}
|
1236
|
-
}
|
1237
|
-
|
1238
|
-
function SchedulePeriodicRecursive(scheduler, state, period, action) {
|
1239
|
-
this._scheduler = scheduler;
|
1240
|
-
this._state = state;
|
1241
|
-
this._period = period;
|
1242
|
-
this._action = action;
|
1243
|
-
}
|
1244
|
-
|
1245
|
-
SchedulePeriodicRecursive.prototype.start = function () {
|
1246
|
-
var d = new SingleAssignmentDisposable();
|
1247
|
-
this._cancel = d;
|
1248
|
-
d.setDisposable(this._scheduler.scheduleRecursiveWithRelativeAndState(0, this._period, tick.bind(this)));
|
1249
|
-
|
1250
|
-
return d;
|
1251
|
-
};
|
1252
|
-
|
1253
|
-
return SchedulePeriodicRecursive;
|
1254
|
-
}());
|
1232
|
+
var SchedulePeriodicRecursive = Rx.internals.SchedulePeriodicRecursive = (function () {
|
1233
|
+
function tick(command, recurse) {
|
1234
|
+
recurse(0, this._period);
|
1235
|
+
try {
|
1236
|
+
this._state = this._action(this._state);
|
1237
|
+
} catch (e) {
|
1238
|
+
this._cancel.dispose();
|
1239
|
+
throw e;
|
1240
|
+
}
|
1241
|
+
}
|
1242
|
+
|
1243
|
+
function SchedulePeriodicRecursive(scheduler, state, period, action) {
|
1244
|
+
this._scheduler = scheduler;
|
1245
|
+
this._state = state;
|
1246
|
+
this._period = period;
|
1247
|
+
this._action = action;
|
1248
|
+
}
|
1249
|
+
|
1250
|
+
SchedulePeriodicRecursive.prototype.start = function () {
|
1251
|
+
var d = new SingleAssignmentDisposable();
|
1252
|
+
this._cancel = d;
|
1253
|
+
d.setDisposable(this._scheduler.scheduleRecursiveWithRelativeAndState(0, this._period, tick.bind(this)));
|
1254
|
+
|
1255
|
+
return d;
|
1256
|
+
};
|
1257
|
+
|
1258
|
+
return SchedulePeriodicRecursive;
|
1259
|
+
}());
|
1255
1260
|
|
1256
1261
|
|
1257
1262
|
var scheduleMethod, clearMethod = noop;
|
@@ -1526,143 +1531,143 @@
|
|
1526
1531
|
};
|
1527
1532
|
}());
|
1528
1533
|
|
1529
|
-
var Enumerator = Rx.internals.Enumerator = function (next) {
|
1530
|
-
this._next = next;
|
1531
|
-
};
|
1532
|
-
|
1533
|
-
Enumerator.prototype.next = function () {
|
1534
|
-
return this._next();
|
1535
|
-
};
|
1536
|
-
|
1537
|
-
Enumerator.prototype[$iterator$] = function () { return this; }
|
1538
|
-
|
1539
|
-
var Enumerable = Rx.internals.Enumerable = function (iterator) {
|
1540
|
-
this._iterator = iterator;
|
1541
|
-
};
|
1542
|
-
|
1543
|
-
Enumerable.prototype[$iterator$] = function () {
|
1544
|
-
return this._iterator();
|
1545
|
-
};
|
1546
|
-
|
1547
|
-
Enumerable.prototype.concat = function () {
|
1548
|
-
var sources = this;
|
1549
|
-
return new AnonymousObservable(function (observer) {
|
1550
|
-
var e;
|
1551
|
-
try {
|
1552
|
-
e = sources[$iterator$]();
|
1553
|
-
} catch(err) {
|
1554
|
-
observer.onError();
|
1555
|
-
return;
|
1556
|
-
}
|
1557
|
-
|
1558
|
-
var isDisposed,
|
1559
|
-
subscription = new SerialDisposable();
|
1560
|
-
var cancelable = immediateScheduler.scheduleRecursive(function (self) {
|
1561
|
-
var currentItem;
|
1562
|
-
if (isDisposed) { return; }
|
1563
|
-
|
1564
|
-
try {
|
1565
|
-
currentItem = e.next();
|
1566
|
-
} catch (ex) {
|
1567
|
-
observer.onError(ex);
|
1568
|
-
return;
|
1569
|
-
}
|
1570
|
-
|
1571
|
-
if (currentItem.done) {
|
1572
|
-
observer.onCompleted();
|
1573
|
-
return;
|
1574
|
-
}
|
1575
|
-
|
1576
|
-
var d = new SingleAssignmentDisposable();
|
1577
|
-
subscription.setDisposable(d);
|
1578
|
-
d.setDisposable(currentItem.value.subscribe(
|
1579
|
-
observer.onNext.bind(observer),
|
1580
|
-
observer.onError.bind(observer),
|
1581
|
-
function () { self(); })
|
1582
|
-
);
|
1583
|
-
});
|
1584
|
-
|
1585
|
-
return new CompositeDisposable(subscription, cancelable, disposableCreate(function () {
|
1586
|
-
isDisposed = true;
|
1587
|
-
}));
|
1588
|
-
});
|
1589
|
-
};
|
1590
|
-
|
1591
|
-
Enumerable.prototype.catchException = function () {
|
1592
|
-
var sources = this;
|
1593
|
-
return new AnonymousObservable(function (observer) {
|
1594
|
-
var e;
|
1595
|
-
try {
|
1596
|
-
e = sources[$iterator$]();
|
1597
|
-
} catch(err) {
|
1598
|
-
observer.onError();
|
1599
|
-
return;
|
1600
|
-
}
|
1601
|
-
|
1602
|
-
var isDisposed,
|
1603
|
-
lastException,
|
1604
|
-
subscription = new SerialDisposable();
|
1605
|
-
var cancelable = immediateScheduler.scheduleRecursive(function (self) {
|
1606
|
-
if (isDisposed) { return; }
|
1607
|
-
|
1608
|
-
var currentItem;
|
1609
|
-
try {
|
1610
|
-
currentItem = e.next();
|
1611
|
-
} catch (ex) {
|
1612
|
-
observer.onError(ex);
|
1613
|
-
return;
|
1614
|
-
}
|
1615
|
-
|
1616
|
-
if (currentItem.done) {
|
1617
|
-
if (lastException) {
|
1618
|
-
observer.onError(lastException);
|
1619
|
-
} else {
|
1620
|
-
observer.onCompleted();
|
1621
|
-
}
|
1622
|
-
return;
|
1623
|
-
}
|
1624
|
-
|
1625
|
-
var d = new SingleAssignmentDisposable();
|
1626
|
-
subscription.setDisposable(d);
|
1627
|
-
d.setDisposable(currentItem.value.subscribe(
|
1628
|
-
observer.onNext.bind(observer),
|
1629
|
-
function (exn) {
|
1630
|
-
lastException = exn;
|
1631
|
-
self();
|
1632
|
-
},
|
1633
|
-
observer.onCompleted.bind(observer)));
|
1634
|
-
});
|
1635
|
-
return new CompositeDisposable(subscription, cancelable, disposableCreate(function () {
|
1636
|
-
isDisposed = true;
|
1637
|
-
}));
|
1638
|
-
});
|
1639
|
-
};
|
1640
|
-
|
1641
|
-
|
1642
|
-
var enumerableRepeat = Enumerable.repeat = function (value, repeatCount) {
|
1643
|
-
if (repeatCount == null) { repeatCount = -1; }
|
1644
|
-
return new Enumerable(function () {
|
1645
|
-
var left = repeatCount;
|
1646
|
-
return new Enumerator(function () {
|
1647
|
-
if (left === 0) { return doneEnumerator; }
|
1648
|
-
if (left > 0) { left--; }
|
1649
|
-
return { done: false, value: value };
|
1650
|
-
});
|
1651
|
-
});
|
1652
|
-
};
|
1653
|
-
|
1654
|
-
var enumerableFor = Enumerable.forEach = function (source, selector, thisArg) {
|
1655
|
-
selector || (selector = identity);
|
1656
|
-
return new Enumerable(function () {
|
1657
|
-
var index = -1;
|
1658
|
-
return new Enumerator(
|
1659
|
-
function () {
|
1660
|
-
return ++index < source.length ?
|
1661
|
-
{ done: false, value: selector.call(thisArg, source[index], index, source) } :
|
1662
|
-
doneEnumerator;
|
1663
|
-
});
|
1664
|
-
});
|
1665
|
-
};
|
1534
|
+
var Enumerator = Rx.internals.Enumerator = function (next) {
|
1535
|
+
this._next = next;
|
1536
|
+
};
|
1537
|
+
|
1538
|
+
Enumerator.prototype.next = function () {
|
1539
|
+
return this._next();
|
1540
|
+
};
|
1541
|
+
|
1542
|
+
Enumerator.prototype[$iterator$] = function () { return this; }
|
1543
|
+
|
1544
|
+
var Enumerable = Rx.internals.Enumerable = function (iterator) {
|
1545
|
+
this._iterator = iterator;
|
1546
|
+
};
|
1547
|
+
|
1548
|
+
Enumerable.prototype[$iterator$] = function () {
|
1549
|
+
return this._iterator();
|
1550
|
+
};
|
1551
|
+
|
1552
|
+
Enumerable.prototype.concat = function () {
|
1553
|
+
var sources = this;
|
1554
|
+
return new AnonymousObservable(function (observer) {
|
1555
|
+
var e;
|
1556
|
+
try {
|
1557
|
+
e = sources[$iterator$]();
|
1558
|
+
} catch(err) {
|
1559
|
+
observer.onError();
|
1560
|
+
return;
|
1561
|
+
}
|
1562
|
+
|
1563
|
+
var isDisposed,
|
1564
|
+
subscription = new SerialDisposable();
|
1565
|
+
var cancelable = immediateScheduler.scheduleRecursive(function (self) {
|
1566
|
+
var currentItem;
|
1567
|
+
if (isDisposed) { return; }
|
1568
|
+
|
1569
|
+
try {
|
1570
|
+
currentItem = e.next();
|
1571
|
+
} catch (ex) {
|
1572
|
+
observer.onError(ex);
|
1573
|
+
return;
|
1574
|
+
}
|
1575
|
+
|
1576
|
+
if (currentItem.done) {
|
1577
|
+
observer.onCompleted();
|
1578
|
+
return;
|
1579
|
+
}
|
1580
|
+
|
1581
|
+
var d = new SingleAssignmentDisposable();
|
1582
|
+
subscription.setDisposable(d);
|
1583
|
+
d.setDisposable(currentItem.value.subscribe(
|
1584
|
+
observer.onNext.bind(observer),
|
1585
|
+
observer.onError.bind(observer),
|
1586
|
+
function () { self(); })
|
1587
|
+
);
|
1588
|
+
});
|
1589
|
+
|
1590
|
+
return new CompositeDisposable(subscription, cancelable, disposableCreate(function () {
|
1591
|
+
isDisposed = true;
|
1592
|
+
}));
|
1593
|
+
});
|
1594
|
+
};
|
1595
|
+
|
1596
|
+
Enumerable.prototype.catchException = function () {
|
1597
|
+
var sources = this;
|
1598
|
+
return new AnonymousObservable(function (observer) {
|
1599
|
+
var e;
|
1600
|
+
try {
|
1601
|
+
e = sources[$iterator$]();
|
1602
|
+
} catch(err) {
|
1603
|
+
observer.onError();
|
1604
|
+
return;
|
1605
|
+
}
|
1606
|
+
|
1607
|
+
var isDisposed,
|
1608
|
+
lastException,
|
1609
|
+
subscription = new SerialDisposable();
|
1610
|
+
var cancelable = immediateScheduler.scheduleRecursive(function (self) {
|
1611
|
+
if (isDisposed) { return; }
|
1612
|
+
|
1613
|
+
var currentItem;
|
1614
|
+
try {
|
1615
|
+
currentItem = e.next();
|
1616
|
+
} catch (ex) {
|
1617
|
+
observer.onError(ex);
|
1618
|
+
return;
|
1619
|
+
}
|
1620
|
+
|
1621
|
+
if (currentItem.done) {
|
1622
|
+
if (lastException) {
|
1623
|
+
observer.onError(lastException);
|
1624
|
+
} else {
|
1625
|
+
observer.onCompleted();
|
1626
|
+
}
|
1627
|
+
return;
|
1628
|
+
}
|
1629
|
+
|
1630
|
+
var d = new SingleAssignmentDisposable();
|
1631
|
+
subscription.setDisposable(d);
|
1632
|
+
d.setDisposable(currentItem.value.subscribe(
|
1633
|
+
observer.onNext.bind(observer),
|
1634
|
+
function (exn) {
|
1635
|
+
lastException = exn;
|
1636
|
+
self();
|
1637
|
+
},
|
1638
|
+
observer.onCompleted.bind(observer)));
|
1639
|
+
});
|
1640
|
+
return new CompositeDisposable(subscription, cancelable, disposableCreate(function () {
|
1641
|
+
isDisposed = true;
|
1642
|
+
}));
|
1643
|
+
});
|
1644
|
+
};
|
1645
|
+
|
1646
|
+
|
1647
|
+
var enumerableRepeat = Enumerable.repeat = function (value, repeatCount) {
|
1648
|
+
if (repeatCount == null) { repeatCount = -1; }
|
1649
|
+
return new Enumerable(function () {
|
1650
|
+
var left = repeatCount;
|
1651
|
+
return new Enumerator(function () {
|
1652
|
+
if (left === 0) { return doneEnumerator; }
|
1653
|
+
if (left > 0) { left--; }
|
1654
|
+
return { done: false, value: value };
|
1655
|
+
});
|
1656
|
+
});
|
1657
|
+
};
|
1658
|
+
|
1659
|
+
var enumerableFor = Enumerable.forEach = function (source, selector, thisArg) {
|
1660
|
+
selector || (selector = identity);
|
1661
|
+
return new Enumerable(function () {
|
1662
|
+
var index = -1;
|
1663
|
+
return new Enumerator(
|
1664
|
+
function () {
|
1665
|
+
return ++index < source.length ?
|
1666
|
+
{ done: false, value: selector.call(thisArg, source[index], index, source) } :
|
1667
|
+
doneEnumerator;
|
1668
|
+
});
|
1669
|
+
});
|
1670
|
+
};
|
1666
1671
|
|
1667
1672
|
/**
|
1668
1673
|
* Supports push-style iteration over an observable sequence.
|
@@ -3811,71 +3816,71 @@
|
|
3811
3816
|
return this.replay(null, bufferSize, window, scheduler).refCount();
|
3812
3817
|
};
|
3813
3818
|
|
3814
|
-
/** @private */
|
3815
|
-
var ConnectableObservable = Rx.ConnectableObservable = (function (_super) {
|
3816
|
-
inherits(ConnectableObservable, _super);
|
3817
|
-
|
3818
|
-
/**
|
3819
|
-
* @constructor
|
3820
|
-
* @private
|
3821
|
-
*/
|
3822
|
-
function ConnectableObservable(source, subject) {
|
3823
|
-
var state = {
|
3824
|
-
subject: subject,
|
3825
|
-
source: source.asObservable(),
|
3826
|
-
hasSubscription: false,
|
3827
|
-
subscription: null
|
3828
|
-
};
|
3829
|
-
|
3830
|
-
this.connect = function () {
|
3831
|
-
if (!state.hasSubscription) {
|
3832
|
-
state.hasSubscription = true;
|
3833
|
-
state.subscription = new CompositeDisposable(state.source.subscribe(state.subject), disposableCreate(function () {
|
3834
|
-
state.hasSubscription = false;
|
3835
|
-
}));
|
3836
|
-
}
|
3837
|
-
return state.subscription;
|
3838
|
-
};
|
3839
|
-
|
3840
|
-
function subscribe(observer) {
|
3841
|
-
return state.subject.subscribe(observer);
|
3842
|
-
}
|
3843
|
-
|
3844
|
-
_super.call(this, subscribe);
|
3845
|
-
}
|
3846
|
-
|
3847
|
-
/**
|
3848
|
-
* @private
|
3849
|
-
* @memberOf ConnectableObservable
|
3850
|
-
*/
|
3851
|
-
ConnectableObservable.prototype.connect = function () { return this.connect(); };
|
3852
|
-
|
3853
|
-
/**
|
3854
|
-
* @private
|
3855
|
-
* @memberOf ConnectableObservable
|
3856
|
-
*/
|
3857
|
-
ConnectableObservable.prototype.refCount = function () {
|
3858
|
-
var connectableSubscription = null, count = 0, source = this;
|
3859
|
-
return new AnonymousObservable(function (observer) {
|
3860
|
-
var shouldConnect, subscription;
|
3861
|
-
count++;
|
3862
|
-
shouldConnect = count === 1;
|
3863
|
-
subscription = source.subscribe(observer);
|
3864
|
-
if (shouldConnect) {
|
3865
|
-
connectableSubscription = source.connect();
|
3866
|
-
}
|
3867
|
-
return disposableCreate(function () {
|
3868
|
-
subscription.dispose();
|
3869
|
-
count--;
|
3870
|
-
if (count === 0) {
|
3871
|
-
connectableSubscription.dispose();
|
3872
|
-
}
|
3873
|
-
});
|
3874
|
-
});
|
3875
|
-
};
|
3876
|
-
|
3877
|
-
return ConnectableObservable;
|
3878
|
-
}(Observable));
|
3819
|
+
/** @private */
|
3820
|
+
var ConnectableObservable = Rx.ConnectableObservable = (function (_super) {
|
3821
|
+
inherits(ConnectableObservable, _super);
|
3822
|
+
|
3823
|
+
/**
|
3824
|
+
* @constructor
|
3825
|
+
* @private
|
3826
|
+
*/
|
3827
|
+
function ConnectableObservable(source, subject) {
|
3828
|
+
var state = {
|
3829
|
+
subject: subject,
|
3830
|
+
source: source.asObservable(),
|
3831
|
+
hasSubscription: false,
|
3832
|
+
subscription: null
|
3833
|
+
};
|
3834
|
+
|
3835
|
+
this.connect = function () {
|
3836
|
+
if (!state.hasSubscription) {
|
3837
|
+
state.hasSubscription = true;
|
3838
|
+
state.subscription = new CompositeDisposable(state.source.subscribe(state.subject), disposableCreate(function () {
|
3839
|
+
state.hasSubscription = false;
|
3840
|
+
}));
|
3841
|
+
}
|
3842
|
+
return state.subscription;
|
3843
|
+
};
|
3844
|
+
|
3845
|
+
function subscribe(observer) {
|
3846
|
+
return state.subject.subscribe(observer);
|
3847
|
+
}
|
3848
|
+
|
3849
|
+
_super.call(this, subscribe);
|
3850
|
+
}
|
3851
|
+
|
3852
|
+
/**
|
3853
|
+
* @private
|
3854
|
+
* @memberOf ConnectableObservable
|
3855
|
+
*/
|
3856
|
+
ConnectableObservable.prototype.connect = function () { return this.connect(); };
|
3857
|
+
|
3858
|
+
/**
|
3859
|
+
* @private
|
3860
|
+
* @memberOf ConnectableObservable
|
3861
|
+
*/
|
3862
|
+
ConnectableObservable.prototype.refCount = function () {
|
3863
|
+
var connectableSubscription = null, count = 0, source = this;
|
3864
|
+
return new AnonymousObservable(function (observer) {
|
3865
|
+
var shouldConnect, subscription;
|
3866
|
+
count++;
|
3867
|
+
shouldConnect = count === 1;
|
3868
|
+
subscription = source.subscribe(observer);
|
3869
|
+
if (shouldConnect) {
|
3870
|
+
connectableSubscription = source.connect();
|
3871
|
+
}
|
3872
|
+
return disposableCreate(function () {
|
3873
|
+
subscription.dispose();
|
3874
|
+
count--;
|
3875
|
+
if (count === 0) {
|
3876
|
+
connectableSubscription.dispose();
|
3877
|
+
}
|
3878
|
+
});
|
3879
|
+
});
|
3880
|
+
};
|
3881
|
+
|
3882
|
+
return ConnectableObservable;
|
3883
|
+
}(Observable));
|
3879
3884
|
|
3880
3885
|
function observableTimerTimeSpan(dueTime, scheduler) {
|
3881
3886
|
var d = normalizeTime(dueTime);
|
@@ -4222,7 +4227,7 @@
|
|
4222
4227
|
* @param {Scheduler} [scheduler] Scheduler on which to run the generator loop. If not specified, the timeout scheduler is used.
|
4223
4228
|
* @returns {Observable} The generated sequence.
|
4224
4229
|
*/
|
4225
|
-
Observable.
|
4230
|
+
Observable.generateWithRelativeTime = function (initialState, condition, iterate, resultSelector, timeSelector, scheduler) {
|
4226
4231
|
scheduler || (scheduler = timeoutScheduler);
|
4227
4232
|
return new AnonymousObservable(function (observer) {
|
4228
4233
|
var first = true,
|
@@ -5061,23 +5066,23 @@
|
|
5061
5066
|
return AutoDetachObserver;
|
5062
5067
|
}(AbstractObserver));
|
5063
5068
|
|
5064
|
-
/** @private */
|
5065
|
-
var InnerSubscription = function (subject, observer) {
|
5066
|
-
this.subject = subject;
|
5067
|
-
this.observer = observer;
|
5068
|
-
};
|
5069
|
-
|
5070
|
-
/**
|
5071
|
-
* @private
|
5072
|
-
* @memberOf InnerSubscription
|
5073
|
-
*/
|
5074
|
-
InnerSubscription.prototype.dispose = function () {
|
5075
|
-
if (!this.subject.isDisposed && this.observer !== null) {
|
5076
|
-
var idx = this.subject.observers.indexOf(this.observer);
|
5077
|
-
this.subject.observers.splice(idx, 1);
|
5078
|
-
this.observer = null;
|
5079
|
-
}
|
5080
|
-
};
|
5069
|
+
/** @private */
|
5070
|
+
var InnerSubscription = function (subject, observer) {
|
5071
|
+
this.subject = subject;
|
5072
|
+
this.observer = observer;
|
5073
|
+
};
|
5074
|
+
|
5075
|
+
/**
|
5076
|
+
* @private
|
5077
|
+
* @memberOf InnerSubscription
|
5078
|
+
*/
|
5079
|
+
InnerSubscription.prototype.dispose = function () {
|
5080
|
+
if (!this.subject.isDisposed && this.observer !== null) {
|
5081
|
+
var idx = this.subject.observers.indexOf(this.observer);
|
5082
|
+
this.subject.observers.splice(idx, 1);
|
5083
|
+
this.observer = null;
|
5084
|
+
}
|
5085
|
+
};
|
5081
5086
|
|
5082
5087
|
/**
|
5083
5088
|
* Represents an object that is both an observable sequence as well as an observer.
|
@@ -5312,50 +5317,50 @@
|
|
5312
5317
|
return AsyncSubject;
|
5313
5318
|
}(Observable));
|
5314
5319
|
|
5315
|
-
/** @private */
|
5316
|
-
var AnonymousSubject = (function (_super) {
|
5317
|
-
inherits(AnonymousSubject, _super);
|
5318
|
-
|
5319
|
-
function subscribe(observer) {
|
5320
|
-
return this.observable.subscribe(observer);
|
5321
|
-
}
|
5322
|
-
|
5323
|
-
/**
|
5324
|
-
* @private
|
5325
|
-
* @constructor
|
5326
|
-
*/
|
5327
|
-
function AnonymousSubject(observer, observable) {
|
5328
|
-
_super.call(this, subscribe);
|
5329
|
-
this.observer = observer;
|
5330
|
-
this.observable = observable;
|
5331
|
-
}
|
5332
|
-
|
5333
|
-
addProperties(AnonymousSubject.prototype, Observer, {
|
5334
|
-
/**
|
5335
|
-
* @private
|
5336
|
-
* @memberOf AnonymousSubject#
|
5337
|
-
*/
|
5338
|
-
onCompleted: function () {
|
5339
|
-
this.observer.onCompleted();
|
5340
|
-
},
|
5341
|
-
/**
|
5342
|
-
* @private
|
5343
|
-
* @memberOf AnonymousSubject#
|
5344
|
-
*/
|
5345
|
-
onError: function (exception) {
|
5346
|
-
this.observer.onError(exception);
|
5347
|
-
},
|
5348
|
-
/**
|
5349
|
-
* @private
|
5350
|
-
* @memberOf AnonymousSubject#
|
5351
|
-
*/
|
5352
|
-
onNext: function (value) {
|
5353
|
-
this.observer.onNext(value);
|
5354
|
-
}
|
5355
|
-
});
|
5356
|
-
|
5357
|
-
return AnonymousSubject;
|
5358
|
-
}(Observable));
|
5320
|
+
/** @private */
|
5321
|
+
var AnonymousSubject = (function (_super) {
|
5322
|
+
inherits(AnonymousSubject, _super);
|
5323
|
+
|
5324
|
+
function subscribe(observer) {
|
5325
|
+
return this.observable.subscribe(observer);
|
5326
|
+
}
|
5327
|
+
|
5328
|
+
/**
|
5329
|
+
* @private
|
5330
|
+
* @constructor
|
5331
|
+
*/
|
5332
|
+
function AnonymousSubject(observer, observable) {
|
5333
|
+
_super.call(this, subscribe);
|
5334
|
+
this.observer = observer;
|
5335
|
+
this.observable = observable;
|
5336
|
+
}
|
5337
|
+
|
5338
|
+
addProperties(AnonymousSubject.prototype, Observer, {
|
5339
|
+
/**
|
5340
|
+
* @private
|
5341
|
+
* @memberOf AnonymousSubject#
|
5342
|
+
*/
|
5343
|
+
onCompleted: function () {
|
5344
|
+
this.observer.onCompleted();
|
5345
|
+
},
|
5346
|
+
/**
|
5347
|
+
* @private
|
5348
|
+
* @memberOf AnonymousSubject#
|
5349
|
+
*/
|
5350
|
+
onError: function (exception) {
|
5351
|
+
this.observer.onError(exception);
|
5352
|
+
},
|
5353
|
+
/**
|
5354
|
+
* @private
|
5355
|
+
* @memberOf AnonymousSubject#
|
5356
|
+
*/
|
5357
|
+
onNext: function (value) {
|
5358
|
+
this.observer.onNext(value);
|
5359
|
+
}
|
5360
|
+
});
|
5361
|
+
|
5362
|
+
return AnonymousSubject;
|
5363
|
+
}(Observable));
|
5359
5364
|
|
5360
5365
|
/**
|
5361
5366
|
* Represents a value that changes over time.
|
@@ -5619,21 +5624,21 @@
|
|
5619
5624
|
return ReplaySubject;
|
5620
5625
|
}(Observable));
|
5621
5626
|
|
5622
|
-
if (typeof define == 'function' && typeof define.amd == 'object' && define.amd) {
|
5623
|
-
root.Rx = Rx;
|
5624
|
-
|
5625
|
-
define(function() {
|
5626
|
-
return Rx;
|
5627
|
-
});
|
5628
|
-
} else if (freeExports && freeModule) {
|
5629
|
-
// in Node.js or RingoJS
|
5630
|
-
if (moduleExports) {
|
5631
|
-
(freeModule.exports = Rx).Rx = Rx;
|
5632
|
-
} else {
|
5633
|
-
freeExports.Rx = Rx;
|
5634
|
-
}
|
5635
|
-
} else {
|
5636
|
-
// in a browser or Rhino
|
5637
|
-
root.Rx = Rx;
|
5627
|
+
if (typeof define == 'function' && typeof define.amd == 'object' && define.amd) {
|
5628
|
+
root.Rx = Rx;
|
5629
|
+
|
5630
|
+
define(function() {
|
5631
|
+
return Rx;
|
5632
|
+
});
|
5633
|
+
} else if (freeExports && freeModule) {
|
5634
|
+
// in Node.js or RingoJS
|
5635
|
+
if (moduleExports) {
|
5636
|
+
(freeModule.exports = Rx).Rx = Rx;
|
5637
|
+
} else {
|
5638
|
+
freeExports.Rx = Rx;
|
5639
|
+
}
|
5640
|
+
} else {
|
5641
|
+
// in a browser or Rhino
|
5642
|
+
root.Rx = Rx;
|
5638
5643
|
}
|
5639
5644
|
}.call(this));
|