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() { }
|
@@ -384,100 +389,100 @@
|
|
384
389
|
return a;
|
385
390
|
}
|
386
391
|
|
387
|
-
// Collections
|
388
|
-
var IndexedItem = function (id, value) {
|
389
|
-
this.id = id;
|
390
|
-
this.value = value;
|
391
|
-
};
|
392
|
-
|
393
|
-
IndexedItem.prototype.compareTo = function (other) {
|
394
|
-
var c = this.value.compareTo(other.value);
|
395
|
-
if (c === 0) {
|
396
|
-
c = this.id - other.id;
|
397
|
-
}
|
398
|
-
return c;
|
399
|
-
};
|
400
|
-
|
401
|
-
// Priority Queue for Scheduling
|
402
|
-
var PriorityQueue = Rx.internals.PriorityQueue = function (capacity) {
|
403
|
-
this.items = new Array(capacity);
|
404
|
-
this.length = 0;
|
405
|
-
};
|
406
|
-
|
407
|
-
var priorityProto = PriorityQueue.prototype;
|
408
|
-
priorityProto.isHigherPriority = function (left, right) {
|
409
|
-
return this.items[left].compareTo(this.items[right]) < 0;
|
410
|
-
};
|
411
|
-
|
412
|
-
priorityProto.percolate = function (index) {
|
413
|
-
if (index >= this.length || index < 0) {
|
414
|
-
return;
|
415
|
-
}
|
416
|
-
var parent = index - 1 >> 1;
|
417
|
-
if (parent < 0 || parent === index) {
|
418
|
-
return;
|
419
|
-
}
|
420
|
-
if (this.isHigherPriority(index, parent)) {
|
421
|
-
var temp = this.items[index];
|
422
|
-
this.items[index] = this.items[parent];
|
423
|
-
this.items[parent] = temp;
|
424
|
-
this.percolate(parent);
|
425
|
-
}
|
426
|
-
};
|
427
|
-
|
428
|
-
priorityProto.heapify = function (index) {
|
429
|
-
if (index === undefined) {
|
430
|
-
index = 0;
|
431
|
-
}
|
432
|
-
if (index >= this.length || index < 0) {
|
433
|
-
return;
|
434
|
-
}
|
435
|
-
var left = 2 * index + 1,
|
436
|
-
right = 2 * index + 2,
|
437
|
-
first = index;
|
438
|
-
if (left < this.length && this.isHigherPriority(left, first)) {
|
439
|
-
first = left;
|
440
|
-
}
|
441
|
-
if (right < this.length && this.isHigherPriority(right, first)) {
|
442
|
-
first = right;
|
443
|
-
}
|
444
|
-
if (first !== index) {
|
445
|
-
var temp = this.items[index];
|
446
|
-
this.items[index] = this.items[first];
|
447
|
-
this.items[first] = temp;
|
448
|
-
this.heapify(first);
|
449
|
-
}
|
450
|
-
};
|
451
|
-
|
452
|
-
priorityProto.peek = function () { return this.items[0].value; };
|
453
|
-
|
454
|
-
priorityProto.removeAt = function (index) {
|
455
|
-
this.items[index] = this.items[--this.length];
|
456
|
-
delete this.items[this.length];
|
457
|
-
this.heapify();
|
458
|
-
};
|
459
|
-
|
460
|
-
priorityProto.dequeue = function () {
|
461
|
-
var result = this.peek();
|
462
|
-
this.removeAt(0);
|
463
|
-
return result;
|
464
|
-
};
|
465
|
-
|
466
|
-
priorityProto.enqueue = function (item) {
|
467
|
-
var index = this.length++;
|
468
|
-
this.items[index] = new IndexedItem(PriorityQueue.count++, item);
|
469
|
-
this.percolate(index);
|
470
|
-
};
|
471
|
-
|
472
|
-
priorityProto.remove = function (item) {
|
473
|
-
for (var i = 0; i < this.length; i++) {
|
474
|
-
if (this.items[i].value === item) {
|
475
|
-
this.removeAt(i);
|
476
|
-
return true;
|
477
|
-
}
|
478
|
-
}
|
479
|
-
return false;
|
480
|
-
};
|
392
|
+
// Collections
|
393
|
+
var IndexedItem = function (id, value) {
|
394
|
+
this.id = id;
|
395
|
+
this.value = value;
|
396
|
+
};
|
397
|
+
|
398
|
+
IndexedItem.prototype.compareTo = function (other) {
|
399
|
+
var c = this.value.compareTo(other.value);
|
400
|
+
if (c === 0) {
|
401
|
+
c = this.id - other.id;
|
402
|
+
}
|
403
|
+
return c;
|
404
|
+
};
|
405
|
+
|
406
|
+
// Priority Queue for Scheduling
|
407
|
+
var PriorityQueue = Rx.internals.PriorityQueue = function (capacity) {
|
408
|
+
this.items = new Array(capacity);
|
409
|
+
this.length = 0;
|
410
|
+
};
|
411
|
+
|
412
|
+
var priorityProto = PriorityQueue.prototype;
|
413
|
+
priorityProto.isHigherPriority = function (left, right) {
|
414
|
+
return this.items[left].compareTo(this.items[right]) < 0;
|
415
|
+
};
|
416
|
+
|
417
|
+
priorityProto.percolate = function (index) {
|
418
|
+
if (index >= this.length || index < 0) {
|
419
|
+
return;
|
420
|
+
}
|
421
|
+
var parent = index - 1 >> 1;
|
422
|
+
if (parent < 0 || parent === index) {
|
423
|
+
return;
|
424
|
+
}
|
425
|
+
if (this.isHigherPriority(index, parent)) {
|
426
|
+
var temp = this.items[index];
|
427
|
+
this.items[index] = this.items[parent];
|
428
|
+
this.items[parent] = temp;
|
429
|
+
this.percolate(parent);
|
430
|
+
}
|
431
|
+
};
|
432
|
+
|
433
|
+
priorityProto.heapify = function (index) {
|
434
|
+
if (index === undefined) {
|
435
|
+
index = 0;
|
436
|
+
}
|
437
|
+
if (index >= this.length || index < 0) {
|
438
|
+
return;
|
439
|
+
}
|
440
|
+
var left = 2 * index + 1,
|
441
|
+
right = 2 * index + 2,
|
442
|
+
first = index;
|
443
|
+
if (left < this.length && this.isHigherPriority(left, first)) {
|
444
|
+
first = left;
|
445
|
+
}
|
446
|
+
if (right < this.length && this.isHigherPriority(right, first)) {
|
447
|
+
first = right;
|
448
|
+
}
|
449
|
+
if (first !== index) {
|
450
|
+
var temp = this.items[index];
|
451
|
+
this.items[index] = this.items[first];
|
452
|
+
this.items[first] = temp;
|
453
|
+
this.heapify(first);
|
454
|
+
}
|
455
|
+
};
|
456
|
+
|
457
|
+
priorityProto.peek = function () { return this.items[0].value; };
|
458
|
+
|
459
|
+
priorityProto.removeAt = function (index) {
|
460
|
+
this.items[index] = this.items[--this.length];
|
461
|
+
delete this.items[this.length];
|
462
|
+
this.heapify();
|
463
|
+
};
|
464
|
+
|
465
|
+
priorityProto.dequeue = function () {
|
466
|
+
var result = this.peek();
|
467
|
+
this.removeAt(0);
|
468
|
+
return result;
|
469
|
+
};
|
470
|
+
|
471
|
+
priorityProto.enqueue = function (item) {
|
472
|
+
var index = this.length++;
|
473
|
+
this.items[index] = new IndexedItem(PriorityQueue.count++, item);
|
474
|
+
this.percolate(index);
|
475
|
+
};
|
476
|
+
|
477
|
+
priorityProto.remove = function (item) {
|
478
|
+
for (var i = 0; i < this.length; i++) {
|
479
|
+
if (this.items[i].value === item) {
|
480
|
+
this.removeAt(i);
|
481
|
+
return true;
|
482
|
+
}
|
483
|
+
}
|
484
|
+
return false;
|
485
|
+
};
|
481
486
|
PriorityQueue.count = 0;
|
482
487
|
/**
|
483
488
|
* Represents a group of disposable resources that are disposed together.
|
@@ -746,30 +751,30 @@
|
|
746
751
|
return RefCountDisposable;
|
747
752
|
})();
|
748
753
|
|
749
|
-
var ScheduledItem = Rx.internals.ScheduledItem = function (scheduler, state, action, dueTime, comparer) {
|
750
|
-
this.scheduler = scheduler;
|
751
|
-
this.state = state;
|
752
|
-
this.action = action;
|
753
|
-
this.dueTime = dueTime;
|
754
|
-
this.comparer = comparer || defaultSubComparer;
|
755
|
-
this.disposable = new SingleAssignmentDisposable();
|
756
|
-
}
|
757
|
-
|
758
|
-
ScheduledItem.prototype.invoke = function () {
|
759
|
-
this.disposable.setDisposable(this.invokeCore());
|
760
|
-
};
|
761
|
-
|
762
|
-
ScheduledItem.prototype.compareTo = function (other) {
|
763
|
-
return this.comparer(this.dueTime, other.dueTime);
|
764
|
-
};
|
765
|
-
|
766
|
-
ScheduledItem.prototype.isCancelled = function () {
|
767
|
-
return this.disposable.isDisposed;
|
768
|
-
};
|
769
|
-
|
770
|
-
ScheduledItem.prototype.invokeCore = function () {
|
771
|
-
return this.action(this.scheduler, this.state);
|
772
|
-
};
|
754
|
+
var ScheduledItem = Rx.internals.ScheduledItem = function (scheduler, state, action, dueTime, comparer) {
|
755
|
+
this.scheduler = scheduler;
|
756
|
+
this.state = state;
|
757
|
+
this.action = action;
|
758
|
+
this.dueTime = dueTime;
|
759
|
+
this.comparer = comparer || defaultSubComparer;
|
760
|
+
this.disposable = new SingleAssignmentDisposable();
|
761
|
+
}
|
762
|
+
|
763
|
+
ScheduledItem.prototype.invoke = function () {
|
764
|
+
this.disposable.setDisposable(this.invokeCore());
|
765
|
+
};
|
766
|
+
|
767
|
+
ScheduledItem.prototype.compareTo = function (other) {
|
768
|
+
return this.comparer(this.dueTime, other.dueTime);
|
769
|
+
};
|
770
|
+
|
771
|
+
ScheduledItem.prototype.isCancelled = function () {
|
772
|
+
return this.disposable.isDisposed;
|
773
|
+
};
|
774
|
+
|
775
|
+
ScheduledItem.prototype.invokeCore = function () {
|
776
|
+
return this.action(this.scheduler, this.state);
|
777
|
+
};
|
773
778
|
|
774
779
|
/** Provides a set of static properties to access commonly used schedulers. */
|
775
780
|
var Scheduler = Rx.Scheduler = (function () {
|
@@ -1024,25 +1029,25 @@
|
|
1024
1029
|
|
1025
1030
|
var normalizeTime = Scheduler.normalize;
|
1026
1031
|
|
1027
|
-
/**
|
1028
|
-
* Gets a scheduler that schedules work immediately on the current thread.
|
1029
|
-
*/
|
1030
|
-
var immediateScheduler = Scheduler.immediate = (function () {
|
1031
|
-
|
1032
|
-
function scheduleNow(state, action) { return action(this, state); }
|
1033
|
-
|
1034
|
-
function scheduleRelative(state, dueTime, action) {
|
1035
|
-
var dt = normalizeTime(dt);
|
1036
|
-
while (dt - this.now() > 0) { }
|
1037
|
-
return action(this, state);
|
1038
|
-
}
|
1039
|
-
|
1040
|
-
function scheduleAbsolute(state, dueTime, action) {
|
1041
|
-
return this.scheduleWithRelativeAndState(state, dueTime - this.now(), action);
|
1042
|
-
}
|
1043
|
-
|
1044
|
-
return new Scheduler(defaultNow, scheduleNow, scheduleRelative, scheduleAbsolute);
|
1045
|
-
}());
|
1032
|
+
/**
|
1033
|
+
* Gets a scheduler that schedules work immediately on the current thread.
|
1034
|
+
*/
|
1035
|
+
var immediateScheduler = Scheduler.immediate = (function () {
|
1036
|
+
|
1037
|
+
function scheduleNow(state, action) { return action(this, state); }
|
1038
|
+
|
1039
|
+
function scheduleRelative(state, dueTime, action) {
|
1040
|
+
var dt = normalizeTime(dt);
|
1041
|
+
while (dt - this.now() > 0) { }
|
1042
|
+
return action(this, state);
|
1043
|
+
}
|
1044
|
+
|
1045
|
+
function scheduleAbsolute(state, dueTime, action) {
|
1046
|
+
return this.scheduleWithRelativeAndState(state, dueTime - this.now(), action);
|
1047
|
+
}
|
1048
|
+
|
1049
|
+
return new Scheduler(defaultNow, scheduleNow, scheduleRelative, scheduleAbsolute);
|
1050
|
+
}());
|
1046
1051
|
|
1047
1052
|
/**
|
1048
1053
|
* Gets a scheduler that schedules work as soon as possible on the current thread.
|
@@ -1106,34 +1111,34 @@
|
|
1106
1111
|
return currentScheduler;
|
1107
1112
|
}());
|
1108
1113
|
|
1109
|
-
var SchedulePeriodicRecursive = Rx.internals.SchedulePeriodicRecursive = (function () {
|
1110
|
-
function tick(command, recurse) {
|
1111
|
-
recurse(0, this._period);
|
1112
|
-
try {
|
1113
|
-
this._state = this._action(this._state);
|
1114
|
-
} catch (e) {
|
1115
|
-
this._cancel.dispose();
|
1116
|
-
throw e;
|
1117
|
-
}
|
1118
|
-
}
|
1119
|
-
|
1120
|
-
function SchedulePeriodicRecursive(scheduler, state, period, action) {
|
1121
|
-
this._scheduler = scheduler;
|
1122
|
-
this._state = state;
|
1123
|
-
this._period = period;
|
1124
|
-
this._action = action;
|
1125
|
-
}
|
1126
|
-
|
1127
|
-
SchedulePeriodicRecursive.prototype.start = function () {
|
1128
|
-
var d = new SingleAssignmentDisposable();
|
1129
|
-
this._cancel = d;
|
1130
|
-
d.setDisposable(this._scheduler.scheduleRecursiveWithRelativeAndState(0, this._period, tick.bind(this)));
|
1131
|
-
|
1132
|
-
return d;
|
1133
|
-
};
|
1134
|
-
|
1135
|
-
return SchedulePeriodicRecursive;
|
1136
|
-
}());
|
1114
|
+
var SchedulePeriodicRecursive = Rx.internals.SchedulePeriodicRecursive = (function () {
|
1115
|
+
function tick(command, recurse) {
|
1116
|
+
recurse(0, this._period);
|
1117
|
+
try {
|
1118
|
+
this._state = this._action(this._state);
|
1119
|
+
} catch (e) {
|
1120
|
+
this._cancel.dispose();
|
1121
|
+
throw e;
|
1122
|
+
}
|
1123
|
+
}
|
1124
|
+
|
1125
|
+
function SchedulePeriodicRecursive(scheduler, state, period, action) {
|
1126
|
+
this._scheduler = scheduler;
|
1127
|
+
this._state = state;
|
1128
|
+
this._period = period;
|
1129
|
+
this._action = action;
|
1130
|
+
}
|
1131
|
+
|
1132
|
+
SchedulePeriodicRecursive.prototype.start = function () {
|
1133
|
+
var d = new SingleAssignmentDisposable();
|
1134
|
+
this._cancel = d;
|
1135
|
+
d.setDisposable(this._scheduler.scheduleRecursiveWithRelativeAndState(0, this._period, tick.bind(this)));
|
1136
|
+
|
1137
|
+
return d;
|
1138
|
+
};
|
1139
|
+
|
1140
|
+
return SchedulePeriodicRecursive;
|
1141
|
+
}());
|
1137
1142
|
|
1138
1143
|
|
1139
1144
|
var scheduleMethod, clearMethod = noop;
|
@@ -1408,143 +1413,143 @@
|
|
1408
1413
|
};
|
1409
1414
|
}());
|
1410
1415
|
|
1411
|
-
var Enumerator = Rx.internals.Enumerator = function (next) {
|
1412
|
-
this._next = next;
|
1413
|
-
};
|
1414
|
-
|
1415
|
-
Enumerator.prototype.next = function () {
|
1416
|
-
return this._next();
|
1417
|
-
};
|
1418
|
-
|
1419
|
-
Enumerator.prototype[$iterator$] = function () { return this; }
|
1420
|
-
|
1421
|
-
var Enumerable = Rx.internals.Enumerable = function (iterator) {
|
1422
|
-
this._iterator = iterator;
|
1423
|
-
};
|
1424
|
-
|
1425
|
-
Enumerable.prototype[$iterator$] = function () {
|
1426
|
-
return this._iterator();
|
1427
|
-
};
|
1428
|
-
|
1429
|
-
Enumerable.prototype.concat = function () {
|
1430
|
-
var sources = this;
|
1431
|
-
return new AnonymousObservable(function (observer) {
|
1432
|
-
var e;
|
1433
|
-
try {
|
1434
|
-
e = sources[$iterator$]();
|
1435
|
-
} catch(err) {
|
1436
|
-
observer.onError();
|
1437
|
-
return;
|
1438
|
-
}
|
1439
|
-
|
1440
|
-
var isDisposed,
|
1441
|
-
subscription = new SerialDisposable();
|
1442
|
-
var cancelable = immediateScheduler.scheduleRecursive(function (self) {
|
1443
|
-
var currentItem;
|
1444
|
-
if (isDisposed) { return; }
|
1445
|
-
|
1446
|
-
try {
|
1447
|
-
currentItem = e.next();
|
1448
|
-
} catch (ex) {
|
1449
|
-
observer.onError(ex);
|
1450
|
-
return;
|
1451
|
-
}
|
1452
|
-
|
1453
|
-
if (currentItem.done) {
|
1454
|
-
observer.onCompleted();
|
1455
|
-
return;
|
1456
|
-
}
|
1457
|
-
|
1458
|
-
var d = new SingleAssignmentDisposable();
|
1459
|
-
subscription.setDisposable(d);
|
1460
|
-
d.setDisposable(currentItem.value.subscribe(
|
1461
|
-
observer.onNext.bind(observer),
|
1462
|
-
observer.onError.bind(observer),
|
1463
|
-
function () { self(); })
|
1464
|
-
);
|
1465
|
-
});
|
1466
|
-
|
1467
|
-
return new CompositeDisposable(subscription, cancelable, disposableCreate(function () {
|
1468
|
-
isDisposed = true;
|
1469
|
-
}));
|
1470
|
-
});
|
1471
|
-
};
|
1472
|
-
|
1473
|
-
Enumerable.prototype.catchException = function () {
|
1474
|
-
var sources = this;
|
1475
|
-
return new AnonymousObservable(function (observer) {
|
1476
|
-
var e;
|
1477
|
-
try {
|
1478
|
-
e = sources[$iterator$]();
|
1479
|
-
} catch(err) {
|
1480
|
-
observer.onError();
|
1481
|
-
return;
|
1482
|
-
}
|
1483
|
-
|
1484
|
-
var isDisposed,
|
1485
|
-
lastException,
|
1486
|
-
subscription = new SerialDisposable();
|
1487
|
-
var cancelable = immediateScheduler.scheduleRecursive(function (self) {
|
1488
|
-
if (isDisposed) { return; }
|
1489
|
-
|
1490
|
-
var currentItem;
|
1491
|
-
try {
|
1492
|
-
currentItem = e.next();
|
1493
|
-
} catch (ex) {
|
1494
|
-
observer.onError(ex);
|
1495
|
-
return;
|
1496
|
-
}
|
1497
|
-
|
1498
|
-
if (currentItem.done) {
|
1499
|
-
if (lastException) {
|
1500
|
-
observer.onError(lastException);
|
1501
|
-
} else {
|
1502
|
-
observer.onCompleted();
|
1503
|
-
}
|
1504
|
-
return;
|
1505
|
-
}
|
1506
|
-
|
1507
|
-
var d = new SingleAssignmentDisposable();
|
1508
|
-
subscription.setDisposable(d);
|
1509
|
-
d.setDisposable(currentItem.value.subscribe(
|
1510
|
-
observer.onNext.bind(observer),
|
1511
|
-
function (exn) {
|
1512
|
-
lastException = exn;
|
1513
|
-
self();
|
1514
|
-
},
|
1515
|
-
observer.onCompleted.bind(observer)));
|
1516
|
-
});
|
1517
|
-
return new CompositeDisposable(subscription, cancelable, disposableCreate(function () {
|
1518
|
-
isDisposed = true;
|
1519
|
-
}));
|
1520
|
-
});
|
1521
|
-
};
|
1522
|
-
|
1523
|
-
|
1524
|
-
var enumerableRepeat = Enumerable.repeat = function (value, repeatCount) {
|
1525
|
-
if (repeatCount == null) { repeatCount = -1; }
|
1526
|
-
return new Enumerable(function () {
|
1527
|
-
var left = repeatCount;
|
1528
|
-
return new Enumerator(function () {
|
1529
|
-
if (left === 0) { return doneEnumerator; }
|
1530
|
-
if (left > 0) { left--; }
|
1531
|
-
return { done: false, value: value };
|
1532
|
-
});
|
1533
|
-
});
|
1534
|
-
};
|
1535
|
-
|
1536
|
-
var enumerableFor = Enumerable.forEach = function (source, selector, thisArg) {
|
1537
|
-
selector || (selector = identity);
|
1538
|
-
return new Enumerable(function () {
|
1539
|
-
var index = -1;
|
1540
|
-
return new Enumerator(
|
1541
|
-
function () {
|
1542
|
-
return ++index < source.length ?
|
1543
|
-
{ done: false, value: selector.call(thisArg, source[index], index, source) } :
|
1544
|
-
doneEnumerator;
|
1545
|
-
});
|
1546
|
-
});
|
1547
|
-
};
|
1416
|
+
var Enumerator = Rx.internals.Enumerator = function (next) {
|
1417
|
+
this._next = next;
|
1418
|
+
};
|
1419
|
+
|
1420
|
+
Enumerator.prototype.next = function () {
|
1421
|
+
return this._next();
|
1422
|
+
};
|
1423
|
+
|
1424
|
+
Enumerator.prototype[$iterator$] = function () { return this; }
|
1425
|
+
|
1426
|
+
var Enumerable = Rx.internals.Enumerable = function (iterator) {
|
1427
|
+
this._iterator = iterator;
|
1428
|
+
};
|
1429
|
+
|
1430
|
+
Enumerable.prototype[$iterator$] = function () {
|
1431
|
+
return this._iterator();
|
1432
|
+
};
|
1433
|
+
|
1434
|
+
Enumerable.prototype.concat = function () {
|
1435
|
+
var sources = this;
|
1436
|
+
return new AnonymousObservable(function (observer) {
|
1437
|
+
var e;
|
1438
|
+
try {
|
1439
|
+
e = sources[$iterator$]();
|
1440
|
+
} catch(err) {
|
1441
|
+
observer.onError();
|
1442
|
+
return;
|
1443
|
+
}
|
1444
|
+
|
1445
|
+
var isDisposed,
|
1446
|
+
subscription = new SerialDisposable();
|
1447
|
+
var cancelable = immediateScheduler.scheduleRecursive(function (self) {
|
1448
|
+
var currentItem;
|
1449
|
+
if (isDisposed) { return; }
|
1450
|
+
|
1451
|
+
try {
|
1452
|
+
currentItem = e.next();
|
1453
|
+
} catch (ex) {
|
1454
|
+
observer.onError(ex);
|
1455
|
+
return;
|
1456
|
+
}
|
1457
|
+
|
1458
|
+
if (currentItem.done) {
|
1459
|
+
observer.onCompleted();
|
1460
|
+
return;
|
1461
|
+
}
|
1462
|
+
|
1463
|
+
var d = new SingleAssignmentDisposable();
|
1464
|
+
subscription.setDisposable(d);
|
1465
|
+
d.setDisposable(currentItem.value.subscribe(
|
1466
|
+
observer.onNext.bind(observer),
|
1467
|
+
observer.onError.bind(observer),
|
1468
|
+
function () { self(); })
|
1469
|
+
);
|
1470
|
+
});
|
1471
|
+
|
1472
|
+
return new CompositeDisposable(subscription, cancelable, disposableCreate(function () {
|
1473
|
+
isDisposed = true;
|
1474
|
+
}));
|
1475
|
+
});
|
1476
|
+
};
|
1477
|
+
|
1478
|
+
Enumerable.prototype.catchException = function () {
|
1479
|
+
var sources = this;
|
1480
|
+
return new AnonymousObservable(function (observer) {
|
1481
|
+
var e;
|
1482
|
+
try {
|
1483
|
+
e = sources[$iterator$]();
|
1484
|
+
} catch(err) {
|
1485
|
+
observer.onError();
|
1486
|
+
return;
|
1487
|
+
}
|
1488
|
+
|
1489
|
+
var isDisposed,
|
1490
|
+
lastException,
|
1491
|
+
subscription = new SerialDisposable();
|
1492
|
+
var cancelable = immediateScheduler.scheduleRecursive(function (self) {
|
1493
|
+
if (isDisposed) { return; }
|
1494
|
+
|
1495
|
+
var currentItem;
|
1496
|
+
try {
|
1497
|
+
currentItem = e.next();
|
1498
|
+
} catch (ex) {
|
1499
|
+
observer.onError(ex);
|
1500
|
+
return;
|
1501
|
+
}
|
1502
|
+
|
1503
|
+
if (currentItem.done) {
|
1504
|
+
if (lastException) {
|
1505
|
+
observer.onError(lastException);
|
1506
|
+
} else {
|
1507
|
+
observer.onCompleted();
|
1508
|
+
}
|
1509
|
+
return;
|
1510
|
+
}
|
1511
|
+
|
1512
|
+
var d = new SingleAssignmentDisposable();
|
1513
|
+
subscription.setDisposable(d);
|
1514
|
+
d.setDisposable(currentItem.value.subscribe(
|
1515
|
+
observer.onNext.bind(observer),
|
1516
|
+
function (exn) {
|
1517
|
+
lastException = exn;
|
1518
|
+
self();
|
1519
|
+
},
|
1520
|
+
observer.onCompleted.bind(observer)));
|
1521
|
+
});
|
1522
|
+
return new CompositeDisposable(subscription, cancelable, disposableCreate(function () {
|
1523
|
+
isDisposed = true;
|
1524
|
+
}));
|
1525
|
+
});
|
1526
|
+
};
|
1527
|
+
|
1528
|
+
|
1529
|
+
var enumerableRepeat = Enumerable.repeat = function (value, repeatCount) {
|
1530
|
+
if (repeatCount == null) { repeatCount = -1; }
|
1531
|
+
return new Enumerable(function () {
|
1532
|
+
var left = repeatCount;
|
1533
|
+
return new Enumerator(function () {
|
1534
|
+
if (left === 0) { return doneEnumerator; }
|
1535
|
+
if (left > 0) { left--; }
|
1536
|
+
return { done: false, value: value };
|
1537
|
+
});
|
1538
|
+
});
|
1539
|
+
};
|
1540
|
+
|
1541
|
+
var enumerableFor = Enumerable.forEach = function (source, selector, thisArg) {
|
1542
|
+
selector || (selector = identity);
|
1543
|
+
return new Enumerable(function () {
|
1544
|
+
var index = -1;
|
1545
|
+
return new Enumerator(
|
1546
|
+
function () {
|
1547
|
+
return ++index < source.length ?
|
1548
|
+
{ done: false, value: selector.call(thisArg, source[index], index, source) } :
|
1549
|
+
doneEnumerator;
|
1550
|
+
});
|
1551
|
+
});
|
1552
|
+
};
|
1548
1553
|
|
1549
1554
|
/**
|
1550
1555
|
* Supports push-style iteration over an observable sequence.
|
@@ -3623,71 +3628,71 @@
|
|
3623
3628
|
return this.replay(null, bufferSize, window, scheduler).refCount();
|
3624
3629
|
};
|
3625
3630
|
|
3626
|
-
/** @private */
|
3627
|
-
var ConnectableObservable = Rx.ConnectableObservable = (function (_super) {
|
3628
|
-
inherits(ConnectableObservable, _super);
|
3629
|
-
|
3630
|
-
/**
|
3631
|
-
* @constructor
|
3632
|
-
* @private
|
3633
|
-
*/
|
3634
|
-
function ConnectableObservable(source, subject) {
|
3635
|
-
var state = {
|
3636
|
-
subject: subject,
|
3637
|
-
source: source.asObservable(),
|
3638
|
-
hasSubscription: false,
|
3639
|
-
subscription: null
|
3640
|
-
};
|
3641
|
-
|
3642
|
-
this.connect = function () {
|
3643
|
-
if (!state.hasSubscription) {
|
3644
|
-
state.hasSubscription = true;
|
3645
|
-
state.subscription = new CompositeDisposable(state.source.subscribe(state.subject), disposableCreate(function () {
|
3646
|
-
state.hasSubscription = false;
|
3647
|
-
}));
|
3648
|
-
}
|
3649
|
-
return state.subscription;
|
3650
|
-
};
|
3651
|
-
|
3652
|
-
function subscribe(observer) {
|
3653
|
-
return state.subject.subscribe(observer);
|
3654
|
-
}
|
3655
|
-
|
3656
|
-
_super.call(this, subscribe);
|
3657
|
-
}
|
3658
|
-
|
3659
|
-
/**
|
3660
|
-
* @private
|
3661
|
-
* @memberOf ConnectableObservable
|
3662
|
-
*/
|
3663
|
-
ConnectableObservable.prototype.connect = function () { return this.connect(); };
|
3664
|
-
|
3665
|
-
/**
|
3666
|
-
* @private
|
3667
|
-
* @memberOf ConnectableObservable
|
3668
|
-
*/
|
3669
|
-
ConnectableObservable.prototype.refCount = function () {
|
3670
|
-
var connectableSubscription = null, count = 0, source = this;
|
3671
|
-
return new AnonymousObservable(function (observer) {
|
3672
|
-
var shouldConnect, subscription;
|
3673
|
-
count++;
|
3674
|
-
shouldConnect = count === 1;
|
3675
|
-
subscription = source.subscribe(observer);
|
3676
|
-
if (shouldConnect) {
|
3677
|
-
connectableSubscription = source.connect();
|
3678
|
-
}
|
3679
|
-
return disposableCreate(function () {
|
3680
|
-
subscription.dispose();
|
3681
|
-
count--;
|
3682
|
-
if (count === 0) {
|
3683
|
-
connectableSubscription.dispose();
|
3684
|
-
}
|
3685
|
-
});
|
3686
|
-
});
|
3687
|
-
};
|
3688
|
-
|
3689
|
-
return ConnectableObservable;
|
3690
|
-
}(Observable));
|
3631
|
+
/** @private */
|
3632
|
+
var ConnectableObservable = Rx.ConnectableObservable = (function (_super) {
|
3633
|
+
inherits(ConnectableObservable, _super);
|
3634
|
+
|
3635
|
+
/**
|
3636
|
+
* @constructor
|
3637
|
+
* @private
|
3638
|
+
*/
|
3639
|
+
function ConnectableObservable(source, subject) {
|
3640
|
+
var state = {
|
3641
|
+
subject: subject,
|
3642
|
+
source: source.asObservable(),
|
3643
|
+
hasSubscription: false,
|
3644
|
+
subscription: null
|
3645
|
+
};
|
3646
|
+
|
3647
|
+
this.connect = function () {
|
3648
|
+
if (!state.hasSubscription) {
|
3649
|
+
state.hasSubscription = true;
|
3650
|
+
state.subscription = new CompositeDisposable(state.source.subscribe(state.subject), disposableCreate(function () {
|
3651
|
+
state.hasSubscription = false;
|
3652
|
+
}));
|
3653
|
+
}
|
3654
|
+
return state.subscription;
|
3655
|
+
};
|
3656
|
+
|
3657
|
+
function subscribe(observer) {
|
3658
|
+
return state.subject.subscribe(observer);
|
3659
|
+
}
|
3660
|
+
|
3661
|
+
_super.call(this, subscribe);
|
3662
|
+
}
|
3663
|
+
|
3664
|
+
/**
|
3665
|
+
* @private
|
3666
|
+
* @memberOf ConnectableObservable
|
3667
|
+
*/
|
3668
|
+
ConnectableObservable.prototype.connect = function () { return this.connect(); };
|
3669
|
+
|
3670
|
+
/**
|
3671
|
+
* @private
|
3672
|
+
* @memberOf ConnectableObservable
|
3673
|
+
*/
|
3674
|
+
ConnectableObservable.prototype.refCount = function () {
|
3675
|
+
var connectableSubscription = null, count = 0, source = this;
|
3676
|
+
return new AnonymousObservable(function (observer) {
|
3677
|
+
var shouldConnect, subscription;
|
3678
|
+
count++;
|
3679
|
+
shouldConnect = count === 1;
|
3680
|
+
subscription = source.subscribe(observer);
|
3681
|
+
if (shouldConnect) {
|
3682
|
+
connectableSubscription = source.connect();
|
3683
|
+
}
|
3684
|
+
return disposableCreate(function () {
|
3685
|
+
subscription.dispose();
|
3686
|
+
count--;
|
3687
|
+
if (count === 0) {
|
3688
|
+
connectableSubscription.dispose();
|
3689
|
+
}
|
3690
|
+
});
|
3691
|
+
});
|
3692
|
+
};
|
3693
|
+
|
3694
|
+
return ConnectableObservable;
|
3695
|
+
}(Observable));
|
3691
3696
|
|
3692
3697
|
function observableTimerTimeSpan(dueTime, scheduler) {
|
3693
3698
|
var d = normalizeTime(dueTime);
|
@@ -4034,7 +4039,7 @@
|
|
4034
4039
|
* @param {Scheduler} [scheduler] Scheduler on which to run the generator loop. If not specified, the timeout scheduler is used.
|
4035
4040
|
* @returns {Observable} The generated sequence.
|
4036
4041
|
*/
|
4037
|
-
Observable.
|
4042
|
+
Observable.generateWithRelativeTime = function (initialState, condition, iterate, resultSelector, timeSelector, scheduler) {
|
4038
4043
|
scheduler || (scheduler = timeoutScheduler);
|
4039
4044
|
return new AnonymousObservable(function (observer) {
|
4040
4045
|
var first = true,
|
@@ -4873,23 +4878,23 @@
|
|
4873
4878
|
return AutoDetachObserver;
|
4874
4879
|
}(AbstractObserver));
|
4875
4880
|
|
4876
|
-
/** @private */
|
4877
|
-
var InnerSubscription = function (subject, observer) {
|
4878
|
-
this.subject = subject;
|
4879
|
-
this.observer = observer;
|
4880
|
-
};
|
4881
|
-
|
4882
|
-
/**
|
4883
|
-
* @private
|
4884
|
-
* @memberOf InnerSubscription
|
4885
|
-
*/
|
4886
|
-
InnerSubscription.prototype.dispose = function () {
|
4887
|
-
if (!this.subject.isDisposed && this.observer !== null) {
|
4888
|
-
var idx = this.subject.observers.indexOf(this.observer);
|
4889
|
-
this.subject.observers.splice(idx, 1);
|
4890
|
-
this.observer = null;
|
4891
|
-
}
|
4892
|
-
};
|
4881
|
+
/** @private */
|
4882
|
+
var InnerSubscription = function (subject, observer) {
|
4883
|
+
this.subject = subject;
|
4884
|
+
this.observer = observer;
|
4885
|
+
};
|
4886
|
+
|
4887
|
+
/**
|
4888
|
+
* @private
|
4889
|
+
* @memberOf InnerSubscription
|
4890
|
+
*/
|
4891
|
+
InnerSubscription.prototype.dispose = function () {
|
4892
|
+
if (!this.subject.isDisposed && this.observer !== null) {
|
4893
|
+
var idx = this.subject.observers.indexOf(this.observer);
|
4894
|
+
this.subject.observers.splice(idx, 1);
|
4895
|
+
this.observer = null;
|
4896
|
+
}
|
4897
|
+
};
|
4893
4898
|
|
4894
4899
|
/**
|
4895
4900
|
* Represents an object that is both an observable sequence as well as an observer.
|
@@ -5124,50 +5129,50 @@
|
|
5124
5129
|
return AsyncSubject;
|
5125
5130
|
}(Observable));
|
5126
5131
|
|
5127
|
-
/** @private */
|
5128
|
-
var AnonymousSubject = (function (_super) {
|
5129
|
-
inherits(AnonymousSubject, _super);
|
5130
|
-
|
5131
|
-
function subscribe(observer) {
|
5132
|
-
return this.observable.subscribe(observer);
|
5133
|
-
}
|
5134
|
-
|
5135
|
-
/**
|
5136
|
-
* @private
|
5137
|
-
* @constructor
|
5138
|
-
*/
|
5139
|
-
function AnonymousSubject(observer, observable) {
|
5140
|
-
_super.call(this, subscribe);
|
5141
|
-
this.observer = observer;
|
5142
|
-
this.observable = observable;
|
5143
|
-
}
|
5144
|
-
|
5145
|
-
addProperties(AnonymousSubject.prototype, Observer, {
|
5146
|
-
/**
|
5147
|
-
* @private
|
5148
|
-
* @memberOf AnonymousSubject#
|
5149
|
-
*/
|
5150
|
-
onCompleted: function () {
|
5151
|
-
this.observer.onCompleted();
|
5152
|
-
},
|
5153
|
-
/**
|
5154
|
-
* @private
|
5155
|
-
* @memberOf AnonymousSubject#
|
5156
|
-
*/
|
5157
|
-
onError: function (exception) {
|
5158
|
-
this.observer.onError(exception);
|
5159
|
-
},
|
5160
|
-
/**
|
5161
|
-
* @private
|
5162
|
-
* @memberOf AnonymousSubject#
|
5163
|
-
*/
|
5164
|
-
onNext: function (value) {
|
5165
|
-
this.observer.onNext(value);
|
5166
|
-
}
|
5167
|
-
});
|
5168
|
-
|
5169
|
-
return AnonymousSubject;
|
5170
|
-
}(Observable));
|
5132
|
+
/** @private */
|
5133
|
+
var AnonymousSubject = (function (_super) {
|
5134
|
+
inherits(AnonymousSubject, _super);
|
5135
|
+
|
5136
|
+
function subscribe(observer) {
|
5137
|
+
return this.observable.subscribe(observer);
|
5138
|
+
}
|
5139
|
+
|
5140
|
+
/**
|
5141
|
+
* @private
|
5142
|
+
* @constructor
|
5143
|
+
*/
|
5144
|
+
function AnonymousSubject(observer, observable) {
|
5145
|
+
_super.call(this, subscribe);
|
5146
|
+
this.observer = observer;
|
5147
|
+
this.observable = observable;
|
5148
|
+
}
|
5149
|
+
|
5150
|
+
addProperties(AnonymousSubject.prototype, Observer, {
|
5151
|
+
/**
|
5152
|
+
* @private
|
5153
|
+
* @memberOf AnonymousSubject#
|
5154
|
+
*/
|
5155
|
+
onCompleted: function () {
|
5156
|
+
this.observer.onCompleted();
|
5157
|
+
},
|
5158
|
+
/**
|
5159
|
+
* @private
|
5160
|
+
* @memberOf AnonymousSubject#
|
5161
|
+
*/
|
5162
|
+
onError: function (exception) {
|
5163
|
+
this.observer.onError(exception);
|
5164
|
+
},
|
5165
|
+
/**
|
5166
|
+
* @private
|
5167
|
+
* @memberOf AnonymousSubject#
|
5168
|
+
*/
|
5169
|
+
onNext: function (value) {
|
5170
|
+
this.observer.onNext(value);
|
5171
|
+
}
|
5172
|
+
});
|
5173
|
+
|
5174
|
+
return AnonymousSubject;
|
5175
|
+
}(Observable));
|
5171
5176
|
|
5172
5177
|
/**
|
5173
5178
|
* Represents a value that changes over time.
|
@@ -5431,21 +5436,21 @@
|
|
5431
5436
|
return ReplaySubject;
|
5432
5437
|
}(Observable));
|
5433
5438
|
|
5434
|
-
if (typeof define == 'function' && typeof define.amd == 'object' && define.amd) {
|
5435
|
-
root.Rx = Rx;
|
5436
|
-
|
5437
|
-
define(function() {
|
5438
|
-
return Rx;
|
5439
|
-
});
|
5440
|
-
} else if (freeExports && freeModule) {
|
5441
|
-
// in Node.js or RingoJS
|
5442
|
-
if (moduleExports) {
|
5443
|
-
(freeModule.exports = Rx).Rx = Rx;
|
5444
|
-
} else {
|
5445
|
-
freeExports.Rx = Rx;
|
5446
|
-
}
|
5447
|
-
} else {
|
5448
|
-
// in a browser or Rhino
|
5449
|
-
root.Rx = Rx;
|
5439
|
+
if (typeof define == 'function' && typeof define.amd == 'object' && define.amd) {
|
5440
|
+
root.Rx = Rx;
|
5441
|
+
|
5442
|
+
define(function() {
|
5443
|
+
return Rx;
|
5444
|
+
});
|
5445
|
+
} else if (freeExports && freeModule) {
|
5446
|
+
// in Node.js or RingoJS
|
5447
|
+
if (moduleExports) {
|
5448
|
+
(freeModule.exports = Rx).Rx = Rx;
|
5449
|
+
} else {
|
5450
|
+
freeExports.Rx = Rx;
|
5451
|
+
}
|
5452
|
+
} else {
|
5453
|
+
// in a browser or Rhino
|
5454
|
+
root.Rx = Rx;
|
5450
5455
|
}
|
5451
5456
|
}.call(this));
|