rxjs-rails 2.3.10 → 2.3.11
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 +120 -70
- data/vendor/assets/javascripts/rx.aggregates.min.js +3 -1
- data/vendor/assets/javascripts/rx.all.compat.js +1810 -1849
- data/vendor/assets/javascripts/rx.all.compat.min.js +5 -3
- data/vendor/assets/javascripts/rx.all.js +1776 -1815
- data/vendor/assets/javascripts/rx.all.min.js +5 -3
- data/vendor/assets/javascripts/rx.async.compat.js +45 -45
- data/vendor/assets/javascripts/rx.async.compat.min.js +3 -1
- data/vendor/assets/javascripts/rx.async.js +39 -39
- data/vendor/assets/javascripts/rx.async.min.js +3 -1
- data/vendor/assets/javascripts/rx.backpressure.js +21 -19
- data/vendor/assets/javascripts/rx.backpressure.min.js +3 -1
- data/vendor/assets/javascripts/rx.binding.js +90 -90
- data/vendor/assets/javascripts/rx.binding.min.js +3 -1
- data/vendor/assets/javascripts/rx.coincidence.js +184 -179
- data/vendor/assets/javascripts/rx.coincidence.min.js +3 -1
- data/vendor/assets/javascripts/rx.compat.js +1019 -1001
- data/vendor/assets/javascripts/rx.compat.min.js +4 -2
- data/vendor/assets/javascripts/rx.experimental.js +65 -64
- data/vendor/assets/javascripts/rx.experimental.min.js +3 -1
- data/vendor/assets/javascripts/rx.joinpatterns.js +265 -363
- data/vendor/assets/javascripts/rx.joinpatterns.min.js +3 -1
- data/vendor/assets/javascripts/rx.js +969 -951
- data/vendor/assets/javascripts/rx.lite.compat.js +1014 -1182
- data/vendor/assets/javascripts/rx.lite.compat.min.js +4 -2
- data/vendor/assets/javascripts/rx.lite.extras.js +101 -109
- data/vendor/assets/javascripts/rx.lite.extras.min.js +3 -1
- data/vendor/assets/javascripts/rx.lite.js +1008 -1176
- data/vendor/assets/javascripts/rx.lite.min.js +4 -2
- data/vendor/assets/javascripts/rx.min.js +4 -2
- data/vendor/assets/javascripts/rx.testing.js +196 -196
- data/vendor/assets/javascripts/rx.testing.min.js +3 -1
- data/vendor/assets/javascripts/rx.time.js +162 -178
- data/vendor/assets/javascripts/rx.time.min.js +3 -1
- data/vendor/assets/javascripts/rx.virtualtime.js +30 -30
- data/vendor/assets/javascripts/rx.virtualtime.min.js +3 -1
- metadata +2 -6
- data/vendor/assets/javascripts/rx.core.compat.js +0 -2548
- data/vendor/assets/javascripts/rx.core.compat.min.js +0 -1
- data/vendor/assets/javascripts/rx.core.js +0 -2430
- data/vendor/assets/javascripts/rx.core.min.js +0 -1
@@ -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
|
|
@@ -16,26 +16,26 @@
|
|
16
16
|
freeModule = objectTypes[typeof module] && module && !module.nodeType && module,
|
17
17
|
moduleExports = freeModule && freeModule.exports === freeExports && freeExports,
|
18
18
|
freeGlobal = objectTypes[typeof global] && global;
|
19
|
-
|
19
|
+
|
20
20
|
if (freeGlobal && (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal)) {
|
21
21
|
root = freeGlobal;
|
22
22
|
}
|
23
23
|
|
24
|
-
var Rx = {
|
25
|
-
internals: {},
|
24
|
+
var Rx = {
|
25
|
+
internals: {},
|
26
26
|
config: {
|
27
27
|
Promise: root.Promise // Detect if promise exists
|
28
28
|
},
|
29
29
|
helpers: { }
|
30
30
|
};
|
31
|
-
|
31
|
+
|
32
32
|
// Defaults
|
33
33
|
var noop = Rx.helpers.noop = function () { },
|
34
34
|
notDefined = Rx.helpers.notDefined = function (x) { return typeof x === 'undefined'; },
|
35
35
|
isScheduler = Rx.helpers.isScheduler = function (x) { return x instanceof Rx.Scheduler; },
|
36
36
|
identity = Rx.helpers.identity = function (x) { return x; },
|
37
37
|
pluck = Rx.helpers.pluck = function (property) { return function (x) { return x[property]; }; },
|
38
|
-
just = Rx.helpers.just = function (value) { return function () { return value; }; },
|
38
|
+
just = Rx.helpers.just = function (value) { return function () { return value; }; },
|
39
39
|
defaultNow = Rx.helpers.defaultNow = Date.now,
|
40
40
|
defaultComparer = Rx.helpers.defaultComparer = function (x, y) { return isEqual(x, y); },
|
41
41
|
defaultSubComparer = Rx.helpers.defaultSubComparer = function (x, y) { return x > y ? 1 : (x < y ? -1 : 0); },
|
@@ -55,7 +55,7 @@
|
|
55
55
|
isFn = function(value) {
|
56
56
|
return typeof value == 'function' && toString.call(value) == '[object Function]';
|
57
57
|
};
|
58
|
-
}
|
58
|
+
}
|
59
59
|
|
60
60
|
return isFn;
|
61
61
|
}());
|
@@ -73,8 +73,10 @@
|
|
73
73
|
if (root.Set && typeof new root.Set()['@@iterator'] === 'function') {
|
74
74
|
$iterator$ = '@@iterator';
|
75
75
|
}
|
76
|
-
|
77
|
-
var doneEnumerator = { done: true, value: undefined };
|
76
|
+
|
77
|
+
var doneEnumerator = Rx.doneEnumerator = { done: true, value: undefined };
|
78
|
+
|
79
|
+
Rx.iterator = $iterator$;
|
78
80
|
|
79
81
|
/** `Object#toString` result shortcuts */
|
80
82
|
var argsClass = '[object Arguments]',
|
@@ -89,7 +91,7 @@
|
|
89
91
|
stringClass = '[object String]';
|
90
92
|
|
91
93
|
var toString = Object.prototype.toString,
|
92
|
-
hasOwnProperty = Object.prototype.hasOwnProperty,
|
94
|
+
hasOwnProperty = Object.prototype.hasOwnProperty,
|
93
95
|
supportsArgsClass = toString.call(arguments) == argsClass, // For less <IE9 && FF<4
|
94
96
|
suportNodeClass,
|
95
97
|
errorProto = Error.prototype,
|
@@ -118,7 +120,7 @@
|
|
118
120
|
props = [];
|
119
121
|
|
120
122
|
ctor.prototype = { 'valueOf': 1, 'y': 1 };
|
121
|
-
for (var key in new ctor) { props.push(key); }
|
123
|
+
for (var key in new ctor) { props.push(key); }
|
122
124
|
for (key in arguments) { }
|
123
125
|
|
124
126
|
// Detect if `name` or `message` properties of `Error.prototype` are enumerable by default.
|
@@ -192,7 +194,7 @@
|
|
192
194
|
}
|
193
195
|
}
|
194
196
|
return object;
|
195
|
-
}
|
197
|
+
}
|
196
198
|
|
197
199
|
function internalForIn(object, callback) {
|
198
200
|
return internalFor(object, callback, keysIn);
|
@@ -213,10 +215,10 @@
|
|
213
215
|
isArguments = function(value) {
|
214
216
|
return (value && typeof value == 'object') ? hasOwnProperty.call(value, 'callee') : false;
|
215
217
|
};
|
216
|
-
}
|
218
|
+
}
|
217
219
|
|
218
220
|
var isEqual = Rx.internals.isEqual = function (x, y) {
|
219
|
-
return deepEquals(x, y, [], []);
|
221
|
+
return deepEquals(x, y, [], []);
|
220
222
|
};
|
221
223
|
|
222
224
|
/** @private
|
@@ -357,133 +359,132 @@
|
|
357
359
|
|
358
360
|
return result;
|
359
361
|
}
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
362
|
+
|
363
|
+
var slice = Array.prototype.slice;
|
364
|
+
function argsOrArray(args, idx) {
|
365
|
+
return args.length === 1 && Array.isArray(args[idx]) ?
|
366
|
+
args[idx] :
|
367
|
+
slice.call(args);
|
368
|
+
}
|
369
|
+
var hasProp = {}.hasOwnProperty;
|
370
|
+
|
371
|
+
var inherits = this.inherits = Rx.internals.inherits = function (child, parent) {
|
372
|
+
function __() { this.constructor = child; }
|
373
|
+
__.prototype = parent.prototype;
|
374
|
+
child.prototype = new __();
|
375
|
+
};
|
376
|
+
|
377
|
+
var addProperties = Rx.internals.addProperties = function (obj) {
|
378
|
+
var sources = slice.call(arguments, 1);
|
379
|
+
for (var i = 0, len = sources.length; i < len; i++) {
|
380
|
+
var source = sources[i];
|
381
|
+
for (var prop in source) {
|
382
|
+
obj[prop] = source[prop];
|
383
|
+
}
|
365
384
|
}
|
366
|
-
|
385
|
+
};
|
367
386
|
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
387
|
+
// Rx Utils
|
388
|
+
var addRef = Rx.internals.addRef = function (xs, r) {
|
389
|
+
return new AnonymousObservable(function (observer) {
|
390
|
+
return new CompositeDisposable(r.getDisposable(), xs.subscribe(observer));
|
391
|
+
});
|
392
|
+
};
|
374
393
|
|
375
|
-
|
376
|
-
var
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
}
|
383
|
-
}
|
384
|
-
};
|
394
|
+
function arrayInitialize(count, factory) {
|
395
|
+
var a = new Array(count);
|
396
|
+
for (var i = 0; i < count; i++) {
|
397
|
+
a[i] = factory();
|
398
|
+
}
|
399
|
+
return a;
|
400
|
+
}
|
385
401
|
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
};
|
402
|
+
// Collections
|
403
|
+
function IndexedItem(id, value) {
|
404
|
+
this.id = id;
|
405
|
+
this.value = value;
|
406
|
+
}
|
392
407
|
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
|
408
|
+
IndexedItem.prototype.compareTo = function (other) {
|
409
|
+
var c = this.value.compareTo(other.value);
|
410
|
+
c === 0 && (c = this.id - other.id);
|
411
|
+
return c;
|
412
|
+
};
|
413
|
+
|
414
|
+
// Priority Queue for Scheduling
|
415
|
+
var PriorityQueue = Rx.internals.PriorityQueue = function (capacity) {
|
416
|
+
this.items = new Array(capacity);
|
417
|
+
this.length = 0;
|
418
|
+
};
|
419
|
+
|
420
|
+
var priorityProto = PriorityQueue.prototype;
|
421
|
+
priorityProto.isHigherPriority = function (left, right) {
|
422
|
+
return this.items[left].compareTo(this.items[right]) < 0;
|
423
|
+
};
|
424
|
+
|
425
|
+
priorityProto.percolate = function (index) {
|
426
|
+
if (index >= this.length || index < 0) { return; }
|
427
|
+
var parent = index - 1 >> 1;
|
428
|
+
if (parent < 0 || parent === index) { return; }
|
429
|
+
if (this.isHigherPriority(index, parent)) {
|
430
|
+
var temp = this.items[index];
|
431
|
+
this.items[index] = this.items[parent];
|
432
|
+
this.items[parent] = temp;
|
433
|
+
this.percolate(parent);
|
400
434
|
}
|
435
|
+
};
|
436
|
+
|
437
|
+
priorityProto.heapify = function (index) {
|
438
|
+
+index || (index = 0);
|
439
|
+
if (index >= this.length || index < 0) { return; }
|
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; };
|
401
458
|
|
402
|
-
|
403
|
-
|
404
|
-
this.
|
405
|
-
this.
|
406
|
-
}
|
407
|
-
|
408
|
-
|
409
|
-
var
|
410
|
-
|
411
|
-
return
|
412
|
-
};
|
413
|
-
|
414
|
-
|
415
|
-
|
416
|
-
this.items = new
|
417
|
-
this.
|
418
|
-
};
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
|
428
|
-
|
429
|
-
if (this.isHigherPriority(index, parent)) {
|
430
|
-
var temp = this.items[index];
|
431
|
-
this.items[index] = this.items[parent];
|
432
|
-
this.items[parent] = temp;
|
433
|
-
this.percolate(parent);
|
434
|
-
}
|
435
|
-
};
|
436
|
-
|
437
|
-
priorityProto.heapify = function (index) {
|
438
|
-
+index || (index = 0);
|
439
|
-
if (index >= this.length || index < 0) { return; }
|
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
|
-
};
|
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
|
+
};
|
486
486
|
PriorityQueue.count = 0;
|
487
|
+
|
487
488
|
/**
|
488
489
|
* Represents a group of disposable resources that are disposed together.
|
489
490
|
* @constructor
|
@@ -499,7 +500,7 @@
|
|
499
500
|
/**
|
500
501
|
* Adds a disposable to the CompositeDisposable or disposes the disposable if the CompositeDisposable is disposed.
|
501
502
|
* @param {Mixed} item Disposable to add.
|
502
|
-
*/
|
503
|
+
*/
|
503
504
|
CompositeDisposablePrototype.add = function (item) {
|
504
505
|
if (this.isDisposed) {
|
505
506
|
item.dispose();
|
@@ -529,7 +530,7 @@
|
|
529
530
|
};
|
530
531
|
|
531
532
|
/**
|
532
|
-
* Disposes all disposables in the group and removes them from the group.
|
533
|
+
* Disposes all disposables in the group and removes them from the group.
|
533
534
|
*/
|
534
535
|
CompositeDisposablePrototype.dispose = function () {
|
535
536
|
if (!this.isDisposed) {
|
@@ -547,15 +548,15 @@
|
|
547
548
|
/**
|
548
549
|
* Converts the existing CompositeDisposable to an array of disposables
|
549
550
|
* @returns {Array} An array of disposable objects.
|
550
|
-
*/
|
551
|
+
*/
|
551
552
|
CompositeDisposablePrototype.toArray = function () {
|
552
553
|
return this.disposables.slice(0);
|
553
554
|
};
|
554
|
-
|
555
|
+
|
555
556
|
/**
|
556
557
|
* Provides a set of static methods for creating Disposables.
|
557
558
|
*
|
558
|
-
* @constructor
|
559
|
+
* @constructor
|
559
560
|
* @param {Function} dispose Action to run during the first call to dispose. The action is guaranteed to be run at most once.
|
560
561
|
*/
|
561
562
|
var Disposable = Rx.Disposable = function (action) {
|
@@ -563,7 +564,7 @@
|
|
563
564
|
this.action = action || noop;
|
564
565
|
};
|
565
566
|
|
566
|
-
/** Performs the task of cleaning up resources. */
|
567
|
+
/** Performs the task of cleaning up resources. */
|
567
568
|
Disposable.prototype.dispose = function () {
|
568
569
|
if (!this.isDisposed) {
|
569
570
|
this.action();
|
@@ -578,8 +579,8 @@
|
|
578
579
|
*/
|
579
580
|
var disposableCreate = Disposable.create = function (action) { return new Disposable(action); };
|
580
581
|
|
581
|
-
/**
|
582
|
-
* Gets the disposable that does nothing when disposed.
|
582
|
+
/**
|
583
|
+
* Gets the disposable that does nothing when disposed.
|
583
584
|
*/
|
584
585
|
var disposableEmpty = Disposable.empty = { dispose: noop };
|
585
586
|
|
@@ -602,7 +603,7 @@
|
|
602
603
|
/**
|
603
604
|
* Sets the underlying disposable.
|
604
605
|
* @param {Disposable} value The new underlying disposable.
|
605
|
-
*/
|
606
|
+
*/
|
606
607
|
booleanDisposablePrototype.setDisposable = function (value) {
|
607
608
|
var shouldDispose = this.isDisposed, old;
|
608
609
|
if (!shouldDispose) {
|
@@ -613,7 +614,7 @@
|
|
613
614
|
shouldDispose && value && value.dispose();
|
614
615
|
};
|
615
616
|
|
616
|
-
/**
|
617
|
+
/**
|
617
618
|
* Disposes the underlying disposable as well as all future replacements.
|
618
619
|
*/
|
619
620
|
booleanDisposablePrototype.dispose = function () {
|
@@ -629,9 +630,10 @@
|
|
629
630
|
return BooleanDisposable;
|
630
631
|
}());
|
631
632
|
var SerialDisposable = Rx.SerialDisposable = SingleAssignmentDisposable;
|
633
|
+
|
632
634
|
/**
|
633
635
|
* Represents a disposable resource that only disposes its underlying disposable resource when all dependent disposable objects have been disposed.
|
634
|
-
*/
|
636
|
+
*/
|
635
637
|
var RefCountDisposable = Rx.RefCountDisposable = (function () {
|
636
638
|
|
637
639
|
function InnerDisposable(disposable) {
|
@@ -665,8 +667,8 @@
|
|
665
667
|
this.count = 0;
|
666
668
|
}
|
667
669
|
|
668
|
-
/**
|
669
|
-
* Disposes the underlying disposable only when all dependent disposables have been disposed
|
670
|
+
/**
|
671
|
+
* Disposes the underlying disposable only when all dependent disposables have been disposed
|
670
672
|
*/
|
671
673
|
RefCountDisposable.prototype.dispose = function () {
|
672
674
|
if (!this.isDisposed) {
|
@@ -681,9 +683,9 @@
|
|
681
683
|
};
|
682
684
|
|
683
685
|
/**
|
684
|
-
* Returns a dependent disposable that when disposed decreases the refcount on the underlying disposable.
|
686
|
+
* Returns a dependent disposable that when disposed decreases the refcount on the underlying disposable.
|
685
687
|
* @returns {Disposable} A dependent disposable contributing to the reference count that manages the underlying disposable's lifetime.
|
686
|
-
*/
|
688
|
+
*/
|
687
689
|
RefCountDisposable.prototype.getDisposable = function () {
|
688
690
|
return this.isDisposed ? disposableEmpty : new InnerDisposable(this);
|
689
691
|
};
|
@@ -691,30 +693,30 @@
|
|
691
693
|
return RefCountDisposable;
|
692
694
|
})();
|
693
695
|
|
694
|
-
var ScheduledItem = Rx.internals.ScheduledItem = function (scheduler, state, action, dueTime, comparer) {
|
695
|
-
this.scheduler = scheduler;
|
696
|
-
this.state = state;
|
697
|
-
this.action = action;
|
698
|
-
this.dueTime = dueTime;
|
699
|
-
this.comparer = comparer || defaultSubComparer;
|
700
|
-
this.disposable = new SingleAssignmentDisposable();
|
701
|
-
}
|
702
|
-
|
703
|
-
ScheduledItem.prototype.invoke = function () {
|
704
|
-
this.disposable.setDisposable(this.invokeCore());
|
705
|
-
};
|
706
|
-
|
707
|
-
ScheduledItem.prototype.compareTo = function (other) {
|
708
|
-
return this.comparer(this.dueTime, other.dueTime);
|
709
|
-
};
|
710
|
-
|
711
|
-
ScheduledItem.prototype.isCancelled = function () {
|
712
|
-
return this.disposable.isDisposed;
|
713
|
-
};
|
714
|
-
|
715
|
-
ScheduledItem.prototype.invokeCore = function () {
|
716
|
-
return this.action(this.scheduler, this.state);
|
717
|
-
};
|
696
|
+
var ScheduledItem = Rx.internals.ScheduledItem = function (scheduler, state, action, dueTime, comparer) {
|
697
|
+
this.scheduler = scheduler;
|
698
|
+
this.state = state;
|
699
|
+
this.action = action;
|
700
|
+
this.dueTime = dueTime;
|
701
|
+
this.comparer = comparer || defaultSubComparer;
|
702
|
+
this.disposable = new SingleAssignmentDisposable();
|
703
|
+
}
|
704
|
+
|
705
|
+
ScheduledItem.prototype.invoke = function () {
|
706
|
+
this.disposable.setDisposable(this.invokeCore());
|
707
|
+
};
|
708
|
+
|
709
|
+
ScheduledItem.prototype.compareTo = function (other) {
|
710
|
+
return this.comparer(this.dueTime, other.dueTime);
|
711
|
+
};
|
712
|
+
|
713
|
+
ScheduledItem.prototype.isCancelled = function () {
|
714
|
+
return this.disposable.isDisposed;
|
715
|
+
};
|
716
|
+
|
717
|
+
ScheduledItem.prototype.invokeCore = function () {
|
718
|
+
return this.action(this.scheduler, this.state);
|
719
|
+
};
|
718
720
|
|
719
721
|
/** Provides a set of static properties to access commonly used schedulers. */
|
720
722
|
var Scheduler = Rx.Scheduler = (function () {
|
@@ -782,7 +784,7 @@
|
|
782
784
|
var schedulerProto = Scheduler.prototype;
|
783
785
|
|
784
786
|
/**
|
785
|
-
* Schedules an action to be executed.
|
787
|
+
* Schedules an action to be executed.
|
786
788
|
* @param {Function} action Action to execute.
|
787
789
|
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
|
788
790
|
*/
|
@@ -791,7 +793,7 @@
|
|
791
793
|
};
|
792
794
|
|
793
795
|
/**
|
794
|
-
* Schedules an action to be executed.
|
796
|
+
* Schedules an action to be executed.
|
795
797
|
* @param state State passed to the action to be executed.
|
796
798
|
* @param {Function} action Action to be executed.
|
797
799
|
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
|
@@ -801,7 +803,7 @@
|
|
801
803
|
};
|
802
804
|
|
803
805
|
/**
|
804
|
-
* Schedules an action to be executed after the specified relative due time.
|
806
|
+
* Schedules an action to be executed after the specified relative due time.
|
805
807
|
* @param {Function} action Action to execute.
|
806
808
|
* @param {Number} dueTime Relative time after which to execute the action.
|
807
809
|
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
|
@@ -811,7 +813,7 @@
|
|
811
813
|
};
|
812
814
|
|
813
815
|
/**
|
814
|
-
* Schedules an action to be executed after dueTime.
|
816
|
+
* Schedules an action to be executed after dueTime.
|
815
817
|
* @param state State passed to the action to be executed.
|
816
818
|
* @param {Function} action Action to be executed.
|
817
819
|
* @param {Number} dueTime Relative time after which to execute the action.
|
@@ -822,7 +824,7 @@
|
|
822
824
|
};
|
823
825
|
|
824
826
|
/**
|
825
|
-
* Schedules an action to be executed at the specified absolute due time.
|
827
|
+
* Schedules an action to be executed at the specified absolute due time.
|
826
828
|
* @param {Function} action Action to execute.
|
827
829
|
* @param {Number} dueTime Absolute time at which to execute the action.
|
828
830
|
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
|
@@ -832,7 +834,7 @@
|
|
832
834
|
};
|
833
835
|
|
834
836
|
/**
|
835
|
-
* Schedules an action to be executed at dueTime.
|
837
|
+
* Schedules an action to be executed at dueTime.
|
836
838
|
* @param {Mixed} state State passed to the action to be executed.
|
837
839
|
* @param {Function} action Action to be executed.
|
838
840
|
* @param {Number}dueTime Absolute time at which to execute the action.
|
@@ -849,7 +851,7 @@
|
|
849
851
|
* Normalizes the specified TimeSpan value to a positive value.
|
850
852
|
* @param {Number} timeSpan The time span value to normalize.
|
851
853
|
* @returns {Number} The specified TimeSpan value if it is zero or positive; otherwise, 0
|
852
|
-
*/
|
854
|
+
*/
|
853
855
|
Scheduler.normalize = function (timeSpan) {
|
854
856
|
timeSpan < 0 && (timeSpan = 0);
|
855
857
|
return timeSpan;
|
@@ -859,7 +861,7 @@
|
|
859
861
|
}());
|
860
862
|
|
861
863
|
var normalizeTime = Scheduler.normalize;
|
862
|
-
|
864
|
+
|
863
865
|
(function (schedulerProto) {
|
864
866
|
function invokeRecImmediate(scheduler, pair) {
|
865
867
|
var state = pair.first, action = pair.second, group = new CompositeDisposable(),
|
@@ -924,7 +926,7 @@
|
|
924
926
|
};
|
925
927
|
|
926
928
|
/**
|
927
|
-
* Schedules an action to be executed recursively.
|
929
|
+
* Schedules an action to be executed recursively.
|
928
930
|
* @param {Mixed} state State passed to the action to be executed.
|
929
931
|
* @param {Function} action Action to execute recursively. The last parameter passed to the action is used to trigger recursive scheduling of the action, passing in recursive invocation state.
|
930
932
|
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
|
@@ -934,7 +936,7 @@
|
|
934
936
|
};
|
935
937
|
|
936
938
|
/**
|
937
|
-
* Schedules an action to be executed recursively after a specified relative due time.
|
939
|
+
* Schedules an action to be executed recursively after a specified relative due time.
|
938
940
|
* @param {Function} action Action to execute recursively. The parameter passed to the action is used to trigger recursive scheduling of the action at the specified relative time.
|
939
941
|
* @param {Number}dueTime Relative time after which to execute the action for the first time.
|
940
942
|
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
|
@@ -944,7 +946,7 @@
|
|
944
946
|
};
|
945
947
|
|
946
948
|
/**
|
947
|
-
* Schedules an action to be executed recursively after a specified relative due time.
|
949
|
+
* Schedules an action to be executed recursively after a specified relative due time.
|
948
950
|
* @param {Mixed} state State passed to the action to be executed.
|
949
951
|
* @param {Function} action Action to execute recursively. The last parameter passed to the action is used to trigger recursive scheduling of the action, passing in the recursive due time and invocation state.
|
950
952
|
* @param {Number}dueTime Relative time after which to execute the action for the first time.
|
@@ -957,7 +959,7 @@
|
|
957
959
|
};
|
958
960
|
|
959
961
|
/**
|
960
|
-
* Schedules an action to be executed recursively at a specified absolute due time.
|
962
|
+
* Schedules an action to be executed recursively at a specified absolute due time.
|
961
963
|
* @param {Function} action Action to execute recursively. The parameter passed to the action is used to trigger recursive scheduling of the action at the specified absolute time.
|
962
964
|
* @param {Number}dueTime Absolute time at which to execute the action for the first time.
|
963
965
|
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
|
@@ -967,7 +969,7 @@
|
|
967
969
|
};
|
968
970
|
|
969
971
|
/**
|
970
|
-
* Schedules an action to be executed recursively at a specified absolute due time.
|
972
|
+
* Schedules an action to be executed recursively at a specified absolute due time.
|
971
973
|
* @param {Mixed} state State passed to the action to be executed.
|
972
974
|
* @param {Function} action Action to execute recursively. The last parameter passed to the action is used to trigger recursive scheduling of the action, passing in the recursive due time and invocation state.
|
973
975
|
* @param {Number}dueTime Absolute time at which to execute the action for the first time.
|
@@ -977,23 +979,23 @@
|
|
977
979
|
return this._scheduleAbsolute({ first: state, second: action }, dueTime, function (s, p) {
|
978
980
|
return invokeRecDate(s, p, 'scheduleWithAbsoluteAndState');
|
979
981
|
});
|
980
|
-
};
|
982
|
+
};
|
981
983
|
}(Scheduler.prototype));
|
982
984
|
|
983
985
|
(function (schedulerProto) {
|
984
986
|
|
985
987
|
/**
|
986
|
-
* Schedules a periodic piece of work by dynamically discovering the scheduler's capabilities. The periodic task will be scheduled using window.setInterval for the base implementation.
|
988
|
+
* Schedules a periodic piece of work by dynamically discovering the scheduler's capabilities. The periodic task will be scheduled using window.setInterval for the base implementation.
|
987
989
|
* @param {Number} period Period for running the work periodically.
|
988
990
|
* @param {Function} action Action to be executed.
|
989
991
|
* @returns {Disposable} The disposable object used to cancel the scheduled recurring action (best effort).
|
990
|
-
*/
|
992
|
+
*/
|
991
993
|
Scheduler.prototype.schedulePeriodic = function (period, action) {
|
992
994
|
return this.schedulePeriodicWithState(null, period, action);
|
993
995
|
};
|
994
996
|
|
995
997
|
/**
|
996
|
-
* Schedules a periodic piece of work by dynamically discovering the scheduler's capabilities. The periodic task will be scheduled using window.setInterval for the base implementation.
|
998
|
+
* Schedules a periodic piece of work by dynamically discovering the scheduler's capabilities. The periodic task will be scheduled using window.setInterval for the base implementation.
|
997
999
|
* @param {Mixed} state Initial state passed to the action upon the first iteration.
|
998
1000
|
* @param {Number} period Period for running the work periodically.
|
999
1001
|
* @param {Function} action Action to be executed, potentially updating the state.
|
@@ -1002,7 +1004,7 @@
|
|
1002
1004
|
Scheduler.prototype.schedulePeriodicWithState = function(state, period, action) {
|
1003
1005
|
if (typeof root.setInterval === 'undefined') { throw new Error('Periodic scheduling not supported.'); }
|
1004
1006
|
var s = state;
|
1005
|
-
|
1007
|
+
|
1006
1008
|
var id = root.setInterval(function () {
|
1007
1009
|
s = action(s);
|
1008
1010
|
}, period);
|
@@ -1013,28 +1015,28 @@
|
|
1013
1015
|
};
|
1014
1016
|
|
1015
1017
|
}(Scheduler.prototype));
|
1016
|
-
|
1017
|
-
/**
|
1018
|
-
* Gets a scheduler that schedules work immediately on the current thread.
|
1019
|
-
*/
|
1020
|
-
var immediateScheduler = Scheduler.immediate = (function () {
|
1021
|
-
|
1022
|
-
function scheduleNow(state, action) { return action(this, state); }
|
1023
|
-
|
1024
|
-
function scheduleRelative(state, dueTime, action) {
|
1025
|
-
var dt = normalizeTime(dt);
|
1026
|
-
while (dt - this.now() > 0) { }
|
1027
|
-
return action(this, state);
|
1028
|
-
}
|
1029
|
-
|
1030
|
-
function scheduleAbsolute(state, dueTime, action) {
|
1031
|
-
return this.scheduleWithRelativeAndState(state, dueTime - this.now(), action);
|
1032
|
-
}
|
1033
|
-
|
1034
|
-
return new Scheduler(defaultNow, scheduleNow, scheduleRelative, scheduleAbsolute);
|
1035
|
-
}());
|
1036
|
-
|
1037
|
-
/**
|
1018
|
+
|
1019
|
+
/**
|
1020
|
+
* Gets a scheduler that schedules work immediately on the current thread.
|
1021
|
+
*/
|
1022
|
+
var immediateScheduler = Scheduler.immediate = (function () {
|
1023
|
+
|
1024
|
+
function scheduleNow(state, action) { return action(this, state); }
|
1025
|
+
|
1026
|
+
function scheduleRelative(state, dueTime, action) {
|
1027
|
+
var dt = normalizeTime(dt);
|
1028
|
+
while (dt - this.now() > 0) { }
|
1029
|
+
return action(this, state);
|
1030
|
+
}
|
1031
|
+
|
1032
|
+
function scheduleAbsolute(state, dueTime, action) {
|
1033
|
+
return this.scheduleWithRelativeAndState(state, dueTime - this.now(), action);
|
1034
|
+
}
|
1035
|
+
|
1036
|
+
return new Scheduler(defaultNow, scheduleNow, scheduleRelative, scheduleAbsolute);
|
1037
|
+
}());
|
1038
|
+
|
1039
|
+
/**
|
1038
1040
|
* Gets a scheduler that schedules work as soon as possible on the current thread.
|
1039
1041
|
*/
|
1040
1042
|
var currentThreadScheduler = Scheduler.currentThread = (function () {
|
@@ -1068,7 +1070,7 @@
|
|
1068
1070
|
queue.enqueue(si);
|
1069
1071
|
try {
|
1070
1072
|
runTrampoline(queue);
|
1071
|
-
} catch (e) {
|
1073
|
+
} catch (e) {
|
1072
1074
|
throw e;
|
1073
1075
|
} finally {
|
1074
1076
|
queue = null;
|
@@ -1084,7 +1086,7 @@
|
|
1084
1086
|
}
|
1085
1087
|
|
1086
1088
|
var currentScheduler = new Scheduler(defaultNow, scheduleNow, scheduleRelative, scheduleAbsolute);
|
1087
|
-
|
1089
|
+
|
1088
1090
|
currentScheduler.scheduleRequired = function () { return !queue; };
|
1089
1091
|
currentScheduler.ensureTrampoline = function (action) {
|
1090
1092
|
if (!queue) { this.schedule(action); } else { action(); }
|
@@ -1093,34 +1095,34 @@
|
|
1093
1095
|
return currentScheduler;
|
1094
1096
|
}());
|
1095
1097
|
|
1096
|
-
var SchedulePeriodicRecursive = Rx.internals.SchedulePeriodicRecursive = (function () {
|
1097
|
-
function tick(command, recurse) {
|
1098
|
-
recurse(0, this._period);
|
1099
|
-
try {
|
1100
|
-
this._state = this._action(this._state);
|
1101
|
-
} catch (e) {
|
1102
|
-
this._cancel.dispose();
|
1103
|
-
throw e;
|
1104
|
-
}
|
1105
|
-
}
|
1106
|
-
|
1107
|
-
function SchedulePeriodicRecursive(scheduler, state, period, action) {
|
1108
|
-
this._scheduler = scheduler;
|
1109
|
-
this._state = state;
|
1110
|
-
this._period = period;
|
1111
|
-
this._action = action;
|
1112
|
-
}
|
1113
|
-
|
1114
|
-
SchedulePeriodicRecursive.prototype.start = function () {
|
1115
|
-
var d = new SingleAssignmentDisposable();
|
1116
|
-
this._cancel = d;
|
1117
|
-
d.setDisposable(this._scheduler.scheduleRecursiveWithRelativeAndState(0, this._period, tick.bind(this)));
|
1118
|
-
|
1119
|
-
return d;
|
1120
|
-
};
|
1121
|
-
|
1122
|
-
return SchedulePeriodicRecursive;
|
1123
|
-
}());
|
1098
|
+
var SchedulePeriodicRecursive = Rx.internals.SchedulePeriodicRecursive = (function () {
|
1099
|
+
function tick(command, recurse) {
|
1100
|
+
recurse(0, this._period);
|
1101
|
+
try {
|
1102
|
+
this._state = this._action(this._state);
|
1103
|
+
} catch (e) {
|
1104
|
+
this._cancel.dispose();
|
1105
|
+
throw e;
|
1106
|
+
}
|
1107
|
+
}
|
1108
|
+
|
1109
|
+
function SchedulePeriodicRecursive(scheduler, state, period, action) {
|
1110
|
+
this._scheduler = scheduler;
|
1111
|
+
this._state = state;
|
1112
|
+
this._period = period;
|
1113
|
+
this._action = action;
|
1114
|
+
}
|
1115
|
+
|
1116
|
+
SchedulePeriodicRecursive.prototype.start = function () {
|
1117
|
+
var d = new SingleAssignmentDisposable();
|
1118
|
+
this._cancel = d;
|
1119
|
+
d.setDisposable(this._scheduler.scheduleRecursiveWithRelativeAndState(0, this._period, tick.bind(this)));
|
1120
|
+
|
1121
|
+
return d;
|
1122
|
+
};
|
1123
|
+
|
1124
|
+
return SchedulePeriodicRecursive;
|
1125
|
+
}());
|
1124
1126
|
|
1125
1127
|
var scheduleMethod, clearMethod = noop;
|
1126
1128
|
var localTimer = (function () {
|
@@ -1141,11 +1143,11 @@
|
|
1141
1143
|
setTimeout: localSetTimeout,
|
1142
1144
|
clearTimeout: localClearTimeout
|
1143
1145
|
};
|
1144
|
-
}());
|
1146
|
+
}());
|
1145
1147
|
var localSetTimeout = localTimer.setTimeout,
|
1146
1148
|
localClearTimeout = localTimer.clearTimeout;
|
1147
1149
|
|
1148
|
-
(function () {
|
1150
|
+
(function () {
|
1149
1151
|
|
1150
1152
|
var reNative = RegExp('^' +
|
1151
1153
|
String(toString)
|
@@ -1161,7 +1163,7 @@
|
|
1161
1163
|
function postMessageSupported () {
|
1162
1164
|
// Ensure not in a worker
|
1163
1165
|
if (!root.postMessage || root.importScripts) { return false; }
|
1164
|
-
var isAsync = false,
|
1166
|
+
var isAsync = false,
|
1165
1167
|
oldHandler = root.onmessage;
|
1166
1168
|
// Test for async
|
1167
1169
|
root.onmessage = function () { isAsync = true; };
|
@@ -1218,19 +1220,19 @@
|
|
1218
1220
|
scheduleMethod = function (action) {
|
1219
1221
|
var id = channelTaskId++;
|
1220
1222
|
channelTasks[id] = action;
|
1221
|
-
channel.port2.postMessage(id);
|
1223
|
+
channel.port2.postMessage(id);
|
1222
1224
|
};
|
1223
1225
|
} else if ('document' in root && 'onreadystatechange' in root.document.createElement('script')) {
|
1224
|
-
|
1226
|
+
|
1225
1227
|
scheduleMethod = function (action) {
|
1226
1228
|
var scriptElement = root.document.createElement('script');
|
1227
|
-
scriptElement.onreadystatechange = function () {
|
1229
|
+
scriptElement.onreadystatechange = function () {
|
1228
1230
|
action();
|
1229
1231
|
scriptElement.onreadystatechange = null;
|
1230
1232
|
scriptElement.parentNode.removeChild(scriptElement);
|
1231
|
-
scriptElement = null;
|
1233
|
+
scriptElement = null;
|
1232
1234
|
};
|
1233
|
-
root.document.documentElement.appendChild(scriptElement);
|
1235
|
+
root.document.documentElement.appendChild(scriptElement);
|
1234
1236
|
};
|
1235
1237
|
|
1236
1238
|
} else {
|
@@ -1239,7 +1241,7 @@
|
|
1239
1241
|
}
|
1240
1242
|
}());
|
1241
1243
|
|
1242
|
-
/**
|
1244
|
+
/**
|
1243
1245
|
* Gets a scheduler that schedules work via a timed callback based upon platform.
|
1244
1246
|
*/
|
1245
1247
|
var timeoutScheduler = Scheduler.timeout = (function () {
|
@@ -1285,14 +1287,14 @@
|
|
1285
1287
|
* Represents a notification to an observer.
|
1286
1288
|
*/
|
1287
1289
|
var Notification = Rx.Notification = (function () {
|
1288
|
-
function Notification(kind, hasValue) {
|
1290
|
+
function Notification(kind, hasValue) {
|
1289
1291
|
this.hasValue = hasValue == null ? false : hasValue;
|
1290
1292
|
this.kind = kind;
|
1291
1293
|
}
|
1292
1294
|
|
1293
1295
|
/**
|
1294
1296
|
* Invokes the delegate corresponding to the notification or the observer's method corresponding to the notification and returns the produced result.
|
1295
|
-
*
|
1297
|
+
*
|
1296
1298
|
* @memberOf Notification
|
1297
1299
|
* @param {Any} observerOrOnNext Delegate to invoke for an OnNext notification or Observer to invoke the notification on..
|
1298
1300
|
* @param {Function} onError Delegate to invoke for an OnError notification.
|
@@ -1307,7 +1309,7 @@
|
|
1307
1309
|
|
1308
1310
|
/**
|
1309
1311
|
* Returns an observable sequence with a single notification.
|
1310
|
-
*
|
1312
|
+
*
|
1311
1313
|
* @memberOf Notifications
|
1312
1314
|
* @param {Scheduler} [scheduler] Scheduler to send out the notification calls on.
|
1313
1315
|
* @returns {Observable} The observable sequence that surfaces the behavior of the notification upon subscription.
|
@@ -1387,299 +1389,280 @@
|
|
1387
1389
|
};
|
1388
1390
|
}());
|
1389
1391
|
|
1390
|
-
var Enumerator = Rx.internals.Enumerator = function (next) {
|
1391
|
-
this._next = next;
|
1392
|
-
};
|
1393
|
-
|
1394
|
-
Enumerator.prototype.next = function () {
|
1395
|
-
return this._next();
|
1396
|
-
};
|
1397
|
-
|
1398
|
-
Enumerator.prototype[$iterator$] = function () { return this; }
|
1399
|
-
|
1400
|
-
var Enumerable = Rx.internals.Enumerable = function (iterator) {
|
1401
|
-
this._iterator = iterator;
|
1402
|
-
};
|
1403
|
-
|
1404
|
-
Enumerable.prototype[$iterator$] = function () {
|
1405
|
-
return this._iterator();
|
1406
|
-
};
|
1407
|
-
|
1408
|
-
Enumerable.prototype.concat = function () {
|
1409
|
-
var sources = this;
|
1410
|
-
return new AnonymousObservable(function (observer) {
|
1411
|
-
var e;
|
1412
|
-
try {
|
1413
|
-
e = sources[$iterator$]();
|
1414
|
-
} catch(err) {
|
1415
|
-
observer.onError();
|
1416
|
-
return;
|
1417
|
-
}
|
1418
|
-
|
1419
|
-
var isDisposed,
|
1420
|
-
subscription = new SerialDisposable();
|
1421
|
-
var cancelable = immediateScheduler.scheduleRecursive(function (self) {
|
1422
|
-
var currentItem;
|
1423
|
-
if (isDisposed) { return; }
|
1424
|
-
|
1425
|
-
try {
|
1426
|
-
currentItem = e.next();
|
1427
|
-
} catch (ex) {
|
1428
|
-
observer.onError(ex);
|
1429
|
-
return;
|
1430
|
-
}
|
1431
|
-
|
1432
|
-
if (currentItem.done) {
|
1433
|
-
observer.onCompleted();
|
1434
|
-
return;
|
1435
|
-
}
|
1436
|
-
|
1437
|
-
// Check if promise
|
1438
|
-
var currentValue = currentItem.value;
|
1439
|
-
isPromise(currentValue) && (currentValue = observableFromPromise(currentValue));
|
1440
|
-
|
1441
|
-
var d = new SingleAssignmentDisposable();
|
1442
|
-
subscription.setDisposable(d);
|
1443
|
-
d.setDisposable(currentValue.subscribe(
|
1444
|
-
observer.onNext.bind(observer),
|
1445
|
-
observer.onError.bind(observer),
|
1446
|
-
function () { self(); })
|
1447
|
-
);
|
1448
|
-
});
|
1449
|
-
|
1450
|
-
return new CompositeDisposable(subscription, cancelable, disposableCreate(function () {
|
1451
|
-
isDisposed = true;
|
1452
|
-
}));
|
1453
|
-
});
|
1454
|
-
};
|
1455
|
-
|
1456
|
-
Enumerable.prototype.catchException = function () {
|
1457
|
-
var sources = this;
|
1458
|
-
return new AnonymousObservable(function (observer) {
|
1459
|
-
var e;
|
1460
|
-
try {
|
1461
|
-
e = sources[$iterator$]();
|
1462
|
-
} catch(err) {
|
1463
|
-
observer.onError();
|
1464
|
-
return;
|
1465
|
-
}
|
1466
|
-
|
1467
|
-
var isDisposed,
|
1468
|
-
lastException,
|
1469
|
-
subscription = new SerialDisposable();
|
1470
|
-
var cancelable = immediateScheduler.scheduleRecursive(function (self) {
|
1471
|
-
if (isDisposed) { return; }
|
1472
|
-
|
1473
|
-
var currentItem;
|
1474
|
-
try {
|
1475
|
-
currentItem = e.next();
|
1476
|
-
} catch (ex) {
|
1477
|
-
observer.onError(ex);
|
1478
|
-
return;
|
1479
|
-
}
|
1480
|
-
|
1481
|
-
if (currentItem.done) {
|
1482
|
-
if (lastException) {
|
1483
|
-
observer.onError(lastException);
|
1484
|
-
} else {
|
1485
|
-
observer.onCompleted();
|
1486
|
-
}
|
1487
|
-
return;
|
1488
|
-
}
|
1489
|
-
|
1490
|
-
// Check if promise
|
1491
|
-
var currentValue = currentItem.value;
|
1492
|
-
isPromise(currentValue) && (currentValue = observableFromPromise(currentValue));
|
1493
|
-
|
1494
|
-
var d = new SingleAssignmentDisposable();
|
1495
|
-
subscription.setDisposable(d);
|
1496
|
-
d.setDisposable(currentValue.subscribe(
|
1497
|
-
observer.onNext.bind(observer),
|
1498
|
-
function (exn) {
|
1499
|
-
lastException = exn;
|
1500
|
-
self();
|
1501
|
-
},
|
1502
|
-
observer.onCompleted.bind(observer)));
|
1503
|
-
});
|
1504
|
-
return new CompositeDisposable(subscription, cancelable, disposableCreate(function () {
|
1505
|
-
isDisposed = true;
|
1506
|
-
}));
|
1507
|
-
});
|
1508
|
-
};
|
1509
|
-
|
1510
|
-
var enumerableRepeat = Enumerable.repeat = function (value, repeatCount) {
|
1511
|
-
if (repeatCount == null) { repeatCount = -1; }
|
1512
|
-
return new Enumerable(function () {
|
1513
|
-
var left = repeatCount;
|
1514
|
-
return new Enumerator(function () {
|
1515
|
-
if (left === 0) { return doneEnumerator; }
|
1516
|
-
if (left > 0) { left--; }
|
1517
|
-
return { done: false, value: value };
|
1518
|
-
});
|
1519
|
-
});
|
1520
|
-
};
|
1521
|
-
|
1522
|
-
var
|
1523
|
-
selector || (selector = identity);
|
1524
|
-
return new Enumerable(function () {
|
1525
|
-
var index = -1;
|
1526
|
-
return new Enumerator(
|
1527
|
-
function () {
|
1528
|
-
return ++index < source.length ?
|
1529
|
-
{ done: false, value: selector.call(thisArg, source[index], index, source) } :
|
1530
|
-
doneEnumerator;
|
1531
|
-
});
|
1532
|
-
});
|
1533
|
-
};
|
1392
|
+
var Enumerator = Rx.internals.Enumerator = function (next) {
|
1393
|
+
this._next = next;
|
1394
|
+
};
|
1395
|
+
|
1396
|
+
Enumerator.prototype.next = function () {
|
1397
|
+
return this._next();
|
1398
|
+
};
|
1399
|
+
|
1400
|
+
Enumerator.prototype[$iterator$] = function () { return this; }
|
1401
|
+
|
1402
|
+
var Enumerable = Rx.internals.Enumerable = function (iterator) {
|
1403
|
+
this._iterator = iterator;
|
1404
|
+
};
|
1405
|
+
|
1406
|
+
Enumerable.prototype[$iterator$] = function () {
|
1407
|
+
return this._iterator();
|
1408
|
+
};
|
1409
|
+
|
1410
|
+
Enumerable.prototype.concat = function () {
|
1411
|
+
var sources = this;
|
1412
|
+
return new AnonymousObservable(function (observer) {
|
1413
|
+
var e;
|
1414
|
+
try {
|
1415
|
+
e = sources[$iterator$]();
|
1416
|
+
} catch(err) {
|
1417
|
+
observer.onError();
|
1418
|
+
return;
|
1419
|
+
}
|
1420
|
+
|
1421
|
+
var isDisposed,
|
1422
|
+
subscription = new SerialDisposable();
|
1423
|
+
var cancelable = immediateScheduler.scheduleRecursive(function (self) {
|
1424
|
+
var currentItem;
|
1425
|
+
if (isDisposed) { return; }
|
1426
|
+
|
1427
|
+
try {
|
1428
|
+
currentItem = e.next();
|
1429
|
+
} catch (ex) {
|
1430
|
+
observer.onError(ex);
|
1431
|
+
return;
|
1432
|
+
}
|
1433
|
+
|
1434
|
+
if (currentItem.done) {
|
1435
|
+
observer.onCompleted();
|
1436
|
+
return;
|
1437
|
+
}
|
1438
|
+
|
1439
|
+
// Check if promise
|
1440
|
+
var currentValue = currentItem.value;
|
1441
|
+
isPromise(currentValue) && (currentValue = observableFromPromise(currentValue));
|
1442
|
+
|
1443
|
+
var d = new SingleAssignmentDisposable();
|
1444
|
+
subscription.setDisposable(d);
|
1445
|
+
d.setDisposable(currentValue.subscribe(
|
1446
|
+
observer.onNext.bind(observer),
|
1447
|
+
observer.onError.bind(observer),
|
1448
|
+
function () { self(); })
|
1449
|
+
);
|
1450
|
+
});
|
1451
|
+
|
1452
|
+
return new CompositeDisposable(subscription, cancelable, disposableCreate(function () {
|
1453
|
+
isDisposed = true;
|
1454
|
+
}));
|
1455
|
+
});
|
1456
|
+
};
|
1457
|
+
|
1458
|
+
Enumerable.prototype.catchException = function () {
|
1459
|
+
var sources = this;
|
1460
|
+
return new AnonymousObservable(function (observer) {
|
1461
|
+
var e;
|
1462
|
+
try {
|
1463
|
+
e = sources[$iterator$]();
|
1464
|
+
} catch(err) {
|
1465
|
+
observer.onError();
|
1466
|
+
return;
|
1467
|
+
}
|
1468
|
+
|
1469
|
+
var isDisposed,
|
1470
|
+
lastException,
|
1471
|
+
subscription = new SerialDisposable();
|
1472
|
+
var cancelable = immediateScheduler.scheduleRecursive(function (self) {
|
1473
|
+
if (isDisposed) { return; }
|
1474
|
+
|
1475
|
+
var currentItem;
|
1476
|
+
try {
|
1477
|
+
currentItem = e.next();
|
1478
|
+
} catch (ex) {
|
1479
|
+
observer.onError(ex);
|
1480
|
+
return;
|
1481
|
+
}
|
1482
|
+
|
1483
|
+
if (currentItem.done) {
|
1484
|
+
if (lastException) {
|
1485
|
+
observer.onError(lastException);
|
1486
|
+
} else {
|
1487
|
+
observer.onCompleted();
|
1488
|
+
}
|
1489
|
+
return;
|
1490
|
+
}
|
1491
|
+
|
1492
|
+
// Check if promise
|
1493
|
+
var currentValue = currentItem.value;
|
1494
|
+
isPromise(currentValue) && (currentValue = observableFromPromise(currentValue));
|
1495
|
+
|
1496
|
+
var d = new SingleAssignmentDisposable();
|
1497
|
+
subscription.setDisposable(d);
|
1498
|
+
d.setDisposable(currentValue.subscribe(
|
1499
|
+
observer.onNext.bind(observer),
|
1500
|
+
function (exn) {
|
1501
|
+
lastException = exn;
|
1502
|
+
self();
|
1503
|
+
},
|
1504
|
+
observer.onCompleted.bind(observer)));
|
1505
|
+
});
|
1506
|
+
return new CompositeDisposable(subscription, cancelable, disposableCreate(function () {
|
1507
|
+
isDisposed = true;
|
1508
|
+
}));
|
1509
|
+
});
|
1510
|
+
};
|
1511
|
+
|
1512
|
+
var enumerableRepeat = Enumerable.repeat = function (value, repeatCount) {
|
1513
|
+
if (repeatCount == null) { repeatCount = -1; }
|
1514
|
+
return new Enumerable(function () {
|
1515
|
+
var left = repeatCount;
|
1516
|
+
return new Enumerator(function () {
|
1517
|
+
if (left === 0) { return doneEnumerator; }
|
1518
|
+
if (left > 0) { left--; }
|
1519
|
+
return { done: false, value: value };
|
1520
|
+
});
|
1521
|
+
});
|
1522
|
+
};
|
1523
|
+
|
1524
|
+
var enumerableOf = Enumerable.of = function (source, selector, thisArg) {
|
1525
|
+
selector || (selector = identity);
|
1526
|
+
return new Enumerable(function () {
|
1527
|
+
var index = -1;
|
1528
|
+
return new Enumerator(
|
1529
|
+
function () {
|
1530
|
+
return ++index < source.length ?
|
1531
|
+
{ done: false, value: selector.call(thisArg, source[index], index, source) } :
|
1532
|
+
doneEnumerator;
|
1533
|
+
});
|
1534
|
+
});
|
1535
|
+
};
|
1536
|
+
|
1537
|
+
/**
|
1538
|
+
* Supports push-style iteration over an observable sequence.
|
1539
|
+
*/
|
1540
|
+
var Observer = Rx.Observer = function () { };
|
1541
|
+
|
1542
|
+
/**
|
1543
|
+
* Creates a notification callback from an observer.
|
1544
|
+
* @returns The action that forwards its input notification to the underlying observer.
|
1545
|
+
*/
|
1546
|
+
Observer.prototype.toNotifier = function () {
|
1547
|
+
var observer = this;
|
1548
|
+
return function (n) { return n.accept(observer); };
|
1549
|
+
};
|
1550
|
+
|
1551
|
+
/**
|
1552
|
+
* Hides the identity of an observer.
|
1553
|
+
* @returns An observer that hides the identity of the specified observer.
|
1554
|
+
*/
|
1555
|
+
Observer.prototype.asObserver = function () {
|
1556
|
+
return new AnonymousObserver(this.onNext.bind(this), this.onError.bind(this), this.onCompleted.bind(this));
|
1557
|
+
};
|
1558
|
+
|
1559
|
+
/**
|
1560
|
+
* Creates an observer from the specified OnNext, along with optional OnError, and OnCompleted actions.
|
1561
|
+
* @param {Function} [onNext] Observer's OnNext action implementation.
|
1562
|
+
* @param {Function} [onError] Observer's OnError action implementation.
|
1563
|
+
* @param {Function} [onCompleted] Observer's OnCompleted action implementation.
|
1564
|
+
* @returns {Observer} The observer object implemented using the given actions.
|
1565
|
+
*/
|
1566
|
+
var observerCreate = Observer.create = function (onNext, onError, onCompleted) {
|
1567
|
+
onNext || (onNext = noop);
|
1568
|
+
onError || (onError = defaultError);
|
1569
|
+
onCompleted || (onCompleted = noop);
|
1570
|
+
return new AnonymousObserver(onNext, onError, onCompleted);
|
1571
|
+
};
|
1572
|
+
|
1573
|
+
/**
|
1574
|
+
* Creates an observer from a notification callback.
|
1575
|
+
* @param {Function} handler Action that handles a notification.
|
1576
|
+
* @returns The observer object that invokes the specified handler using a notification corresponding to each message it receives.
|
1577
|
+
*/
|
1578
|
+
Observer.fromNotifier = function (handler, thisArg) {
|
1579
|
+
return new AnonymousObserver(function (x) {
|
1580
|
+
return handler.call(thisArg, notificationCreateOnNext(x));
|
1581
|
+
}, function (e) {
|
1582
|
+
return handler.call(thisArg, notificationCreateOnError(e));
|
1583
|
+
}, function () {
|
1584
|
+
return handler.call(thisArg, notificationCreateOnCompleted());
|
1585
|
+
});
|
1586
|
+
};
|
1587
|
+
|
1588
|
+
/**
|
1589
|
+
* Abstract base class for implementations of the Observer class.
|
1590
|
+
* This base class enforces the grammar of observers where OnError and OnCompleted are terminal messages.
|
1591
|
+
*/
|
1592
|
+
var AbstractObserver = Rx.internals.AbstractObserver = (function (__super__) {
|
1593
|
+
inherits(AbstractObserver, __super__);
|
1534
1594
|
|
1535
1595
|
/**
|
1536
|
-
*
|
1596
|
+
* Creates a new observer in a non-stopped state.
|
1537
1597
|
*/
|
1538
|
-
|
1598
|
+
function AbstractObserver() {
|
1599
|
+
this.isStopped = false;
|
1600
|
+
__super__.call(this);
|
1601
|
+
}
|
1539
1602
|
|
1540
1603
|
/**
|
1541
|
-
*
|
1542
|
-
*
|
1543
|
-
* @param observer Observer object.
|
1544
|
-
* @returns The action that forwards its input notification to the underlying observer.
|
1604
|
+
* Notifies the observer of a new element in the sequence.
|
1605
|
+
* @param {Any} value Next element in the sequence.
|
1545
1606
|
*/
|
1546
|
-
|
1547
|
-
|
1548
|
-
return function (n) {
|
1549
|
-
return n.accept(observer);
|
1550
|
-
};
|
1607
|
+
AbstractObserver.prototype.onNext = function (value) {
|
1608
|
+
if (!this.isStopped) { this.next(value); }
|
1551
1609
|
};
|
1552
1610
|
|
1553
1611
|
/**
|
1554
|
-
*
|
1555
|
-
|
1556
|
-
|
1557
|
-
|
1558
|
-
|
1559
|
-
|
1612
|
+
* Notifies the observer that an exception has occurred.
|
1613
|
+
* @param {Any} error The error that has occurred.
|
1614
|
+
*/
|
1615
|
+
AbstractObserver.prototype.onError = function (error) {
|
1616
|
+
if (!this.isStopped) {
|
1617
|
+
this.isStopped = true;
|
1618
|
+
this.error(error);
|
1619
|
+
}
|
1560
1620
|
};
|
1561
1621
|
|
1562
1622
|
/**
|
1563
|
-
*
|
1564
|
-
*
|
1565
|
-
* @static
|
1566
|
-
* @memberOf Observer
|
1567
|
-
* @param {Function} [onNext] Observer's OnNext action implementation.
|
1568
|
-
* @param {Function} [onError] Observer's OnError action implementation.
|
1569
|
-
* @param {Function} [onCompleted] Observer's OnCompleted action implementation.
|
1570
|
-
* @returns {Observer} The observer object implemented using the given actions.
|
1623
|
+
* Notifies the observer of the end of the sequence.
|
1571
1624
|
*/
|
1572
|
-
|
1573
|
-
|
1574
|
-
|
1575
|
-
|
1576
|
-
|
1625
|
+
AbstractObserver.prototype.onCompleted = function () {
|
1626
|
+
if (!this.isStopped) {
|
1627
|
+
this.isStopped = true;
|
1628
|
+
this.completed();
|
1629
|
+
}
|
1577
1630
|
};
|
1578
1631
|
|
1579
1632
|
/**
|
1580
|
-
*
|
1581
|
-
*
|
1582
|
-
* @static
|
1583
|
-
* @memberOf Observer
|
1584
|
-
* @param {Function} handler Action that handles a notification.
|
1585
|
-
* @returns The observer object that invokes the specified handler using a notification corresponding to each message it receives.
|
1633
|
+
* Disposes the observer, causing it to transition to the stopped state.
|
1586
1634
|
*/
|
1587
|
-
|
1588
|
-
|
1589
|
-
return handler(notificationCreateOnNext(x));
|
1590
|
-
}, function (exception) {
|
1591
|
-
return handler(notificationCreateOnError(exception));
|
1592
|
-
}, function () {
|
1593
|
-
return handler(notificationCreateOnCompleted());
|
1594
|
-
});
|
1635
|
+
AbstractObserver.prototype.dispose = function () {
|
1636
|
+
this.isStopped = true;
|
1595
1637
|
};
|
1596
|
-
|
1597
|
-
/**
|
1598
|
-
* Abstract base class for implementations of the Observer class.
|
1599
|
-
* This base class enforces the grammar of observers where OnError and OnCompleted are terminal messages.
|
1600
|
-
*/
|
1601
|
-
var AbstractObserver = Rx.internals.AbstractObserver = (function (_super) {
|
1602
|
-
inherits(AbstractObserver, _super);
|
1603
|
-
|
1604
|
-
/**
|
1605
|
-
* Creates a new observer in a non-stopped state.
|
1606
|
-
*
|
1607
|
-
* @constructor
|
1608
|
-
*/
|
1609
|
-
function AbstractObserver() {
|
1610
|
-
this.isStopped = false;
|
1611
|
-
_super.call(this);
|
1612
|
-
}
|
1613
|
-
|
1614
|
-
/**
|
1615
|
-
* Notifies the observer of a new element in the sequence.
|
1616
|
-
*
|
1617
|
-
* @memberOf AbstractObserver
|
1618
|
-
* @param {Any} value Next element in the sequence.
|
1619
|
-
*/
|
1620
|
-
AbstractObserver.prototype.onNext = function (value) {
|
1621
|
-
if (!this.isStopped) {
|
1622
|
-
this.next(value);
|
1623
|
-
}
|
1624
|
-
};
|
1625
|
-
|
1626
|
-
/**
|
1627
|
-
* Notifies the observer that an exception has occurred.
|
1628
|
-
*
|
1629
|
-
* @memberOf AbstractObserver
|
1630
|
-
* @param {Any} error The error that has occurred.
|
1631
|
-
*/
|
1632
|
-
AbstractObserver.prototype.onError = function (error) {
|
1633
|
-
if (!this.isStopped) {
|
1634
|
-
this.isStopped = true;
|
1635
|
-
this.error(error);
|
1636
|
-
}
|
1637
|
-
};
|
1638
|
-
|
1639
|
-
/**
|
1640
|
-
* Notifies the observer of the end of the sequence.
|
1641
|
-
*/
|
1642
|
-
AbstractObserver.prototype.onCompleted = function () {
|
1643
|
-
if (!this.isStopped) {
|
1644
|
-
this.isStopped = true;
|
1645
|
-
this.completed();
|
1646
|
-
}
|
1647
|
-
};
|
1648
|
-
|
1649
|
-
/**
|
1650
|
-
* Disposes the observer, causing it to transition to the stopped state.
|
1651
|
-
*/
|
1652
|
-
AbstractObserver.prototype.dispose = function () {
|
1653
|
-
this.isStopped = true;
|
1654
|
-
};
|
1655
1638
|
|
1656
|
-
|
1657
|
-
|
1658
|
-
|
1659
|
-
|
1660
|
-
|
1661
|
-
|
1639
|
+
AbstractObserver.prototype.fail = function (e) {
|
1640
|
+
if (!this.isStopped) {
|
1641
|
+
this.isStopped = true;
|
1642
|
+
this.error(e);
|
1643
|
+
return true;
|
1644
|
+
}
|
1662
1645
|
|
1663
|
-
|
1664
|
-
|
1646
|
+
return false;
|
1647
|
+
};
|
1665
1648
|
|
1666
|
-
|
1667
|
-
|
1649
|
+
return AbstractObserver;
|
1650
|
+
}(Observer));
|
1668
1651
|
|
1669
1652
|
/**
|
1670
1653
|
* Class to create an Observer instance from delegate-based implementations of the on* methods.
|
1671
1654
|
*/
|
1672
|
-
var AnonymousObserver = Rx.AnonymousObserver = (function (
|
1673
|
-
inherits(AnonymousObserver,
|
1655
|
+
var AnonymousObserver = Rx.AnonymousObserver = (function (__super__) {
|
1656
|
+
inherits(AnonymousObserver, __super__);
|
1674
1657
|
|
1675
1658
|
/**
|
1676
1659
|
* Creates an observer from the specified OnNext, OnError, and OnCompleted actions.
|
1677
1660
|
* @param {Any} onNext Observer's OnNext action implementation.
|
1678
1661
|
* @param {Any} onError Observer's OnError action implementation.
|
1679
|
-
* @param {Any} onCompleted Observer's OnCompleted action implementation.
|
1680
|
-
*/
|
1662
|
+
* @param {Any} onCompleted Observer's OnCompleted action implementation.
|
1663
|
+
*/
|
1681
1664
|
function AnonymousObserver(onNext, onError, onCompleted) {
|
1682
|
-
|
1665
|
+
__super__.call(this);
|
1683
1666
|
this._onNext = onNext;
|
1684
1667
|
this._onError = onError;
|
1685
1668
|
this._onCompleted = onCompleted;
|
@@ -1687,23 +1670,23 @@
|
|
1687
1670
|
|
1688
1671
|
/**
|
1689
1672
|
* Calls the onNext action.
|
1690
|
-
* @param {Any} value Next element in the sequence.
|
1691
|
-
*/
|
1673
|
+
* @param {Any} value Next element in the sequence.
|
1674
|
+
*/
|
1692
1675
|
AnonymousObserver.prototype.next = function (value) {
|
1693
1676
|
this._onNext(value);
|
1694
1677
|
};
|
1695
1678
|
|
1696
1679
|
/**
|
1697
1680
|
* Calls the onError action.
|
1698
|
-
* @param {Any} error The error that has occurred.
|
1699
|
-
*/
|
1700
|
-
AnonymousObserver.prototype.error = function (
|
1701
|
-
this._onError(
|
1681
|
+
* @param {Any} error The error that has occurred.
|
1682
|
+
*/
|
1683
|
+
AnonymousObserver.prototype.error = function (error) {
|
1684
|
+
this._onError(error);
|
1702
1685
|
};
|
1703
1686
|
|
1704
1687
|
/**
|
1705
1688
|
* Calls the onCompleted action.
|
1706
|
-
*/
|
1689
|
+
*/
|
1707
1690
|
AnonymousObserver.prototype.completed = function () {
|
1708
1691
|
this._onCompleted();
|
1709
1692
|
};
|
@@ -1726,24 +1709,45 @@
|
|
1726
1709
|
|
1727
1710
|
/**
|
1728
1711
|
* Subscribes an observer to the observable sequence.
|
1729
|
-
*
|
1730
|
-
* @example
|
1731
|
-
* 1 - source.subscribe();
|
1732
|
-
* 2 - source.subscribe(observer);
|
1733
|
-
* 3 - source.subscribe(function (x) { console.log(x); });
|
1734
|
-
* 4 - source.subscribe(function (x) { console.log(x); }, function (err) { console.log(err); });
|
1735
|
-
* 5 - source.subscribe(function (x) { console.log(x); }, function (err) { console.log(err); }, function () { console.log('done'); });
|
1736
1712
|
* @param {Mixed} [observerOrOnNext] The object that is to receive notifications or an action to invoke for each element in the observable sequence.
|
1737
1713
|
* @param {Function} [onError] Action to invoke upon exceptional termination of the observable sequence.
|
1738
1714
|
* @param {Function} [onCompleted] Action to invoke upon graceful termination of the observable sequence.
|
1739
|
-
* @returns {Diposable}
|
1715
|
+
* @returns {Diposable} A disposable handling the subscriptions and unsubscriptions.
|
1740
1716
|
*/
|
1741
1717
|
observableProto.subscribe = observableProto.forEach = function (observerOrOnNext, onError, onCompleted) {
|
1742
|
-
|
1718
|
+
return this._subscribe(typeof observerOrOnNext === 'object' ?
|
1743
1719
|
observerOrOnNext :
|
1744
|
-
observerCreate(observerOrOnNext, onError, onCompleted);
|
1720
|
+
observerCreate(observerOrOnNext, onError, onCompleted));
|
1721
|
+
};
|
1745
1722
|
|
1746
|
-
|
1723
|
+
/**
|
1724
|
+
* Subscribes to the next value in the sequence with an optional "this" argument.
|
1725
|
+
* @param {Function} onNext The function to invoke on each element in the observable sequence.
|
1726
|
+
* @param {Any} [thisArg] Object to use as this when executing callback.
|
1727
|
+
* @returns {Disposable} A disposable handling the subscriptions and unsubscriptions.
|
1728
|
+
*/
|
1729
|
+
observableProto.subscribeOnNext = function (onNext, thisArg) {
|
1730
|
+
return this._subscribe(observerCreate(arguments.length === 2 ? function(x) { onNext.call(thisArg, x); } : onNext));
|
1731
|
+
};
|
1732
|
+
|
1733
|
+
/**
|
1734
|
+
* Subscribes to an exceptional condition in the sequence with an optional "this" argument.
|
1735
|
+
* @param {Function} onError The function to invoke upon exceptional termination of the observable sequence.
|
1736
|
+
* @param {Any} [thisArg] Object to use as this when executing callback.
|
1737
|
+
* @returns {Disposable} A disposable handling the subscriptions and unsubscriptions.
|
1738
|
+
*/
|
1739
|
+
observableProto.subscribeOnError = function (onError, thisArg) {
|
1740
|
+
return this._subscribe(observerCreate(null, arguments.length === 2 ? function(e) { onError.call(thisArg, e); } : onError));
|
1741
|
+
};
|
1742
|
+
|
1743
|
+
/**
|
1744
|
+
* Subscribes to the next value in the sequence with an optional "this" argument.
|
1745
|
+
* @param {Function} onCompleted The function to invoke upon graceful termination of the observable sequence.
|
1746
|
+
* @param {Any} [thisArg] Object to use as this when executing callback.
|
1747
|
+
* @returns {Disposable} A disposable handling the subscriptions and unsubscriptions.
|
1748
|
+
*/
|
1749
|
+
observableProto.subscribeOnCompleted = function (onCompleted, thisArg) {
|
1750
|
+
return this._subscribe(observerCreate(null, null, arguments.length === 2 ? function() { onCompleted.call(thisArg); } : onCompleted));
|
1747
1751
|
};
|
1748
1752
|
|
1749
1753
|
return Observable;
|
@@ -1820,7 +1824,7 @@
|
|
1820
1824
|
|
1821
1825
|
/**
|
1822
1826
|
* Creates a list from an observable sequence.
|
1823
|
-
* @returns An observable sequence containing a single element with a list containing all the elements of the source sequence.
|
1827
|
+
* @returns An observable sequence containing a single element with a list containing all the elements of the source sequence.
|
1824
1828
|
*/
|
1825
1829
|
observableProto.toArray = function () {
|
1826
1830
|
var self = this;
|
@@ -1838,12 +1842,12 @@
|
|
1838
1842
|
|
1839
1843
|
/**
|
1840
1844
|
* Creates an observable sequence from a specified subscribe method implementation.
|
1841
|
-
*
|
1845
|
+
*
|
1842
1846
|
* @example
|
1843
1847
|
* var res = Rx.Observable.create(function (observer) { return function () { } );
|
1844
|
-
* var res = Rx.Observable.create(function (observer) { return Rx.Disposable.empty; } );
|
1845
|
-
* var res = Rx.Observable.create(function (observer) { } );
|
1846
|
-
*
|
1848
|
+
* var res = Rx.Observable.create(function (observer) { return Rx.Disposable.empty; } );
|
1849
|
+
* var res = Rx.Observable.create(function (observer) { } );
|
1850
|
+
*
|
1847
1851
|
* @param {Function} subscribe Implementation of the resulting observable sequence's subscribe method, returning a function that will be wrapped in a Disposable.
|
1848
1852
|
* @returns {Observable} The observable sequence with the specified implementation for the Subscribe method.
|
1849
1853
|
*/
|
@@ -1853,9 +1857,9 @@
|
|
1853
1857
|
|
1854
1858
|
/**
|
1855
1859
|
* Returns an observable sequence that invokes the specified factory function whenever a new observer subscribes.
|
1856
|
-
*
|
1860
|
+
*
|
1857
1861
|
* @example
|
1858
|
-
* var res = Rx.Observable.defer(function () { return Rx.Observable.fromArray([1,2,3]); });
|
1862
|
+
* var res = Rx.Observable.defer(function () { return Rx.Observable.fromArray([1,2,3]); });
|
1859
1863
|
* @param {Function} observableFactory Observable factory function to invoke for each observer that subscribes to the resulting sequence or Promise.
|
1860
1864
|
* @returns {Observable} An observable sequence whose observers trigger an invocation of the given observable factory function.
|
1861
1865
|
*/
|
@@ -1874,10 +1878,10 @@
|
|
1874
1878
|
|
1875
1879
|
/**
|
1876
1880
|
* Returns an empty observable sequence, using the specified scheduler to send out the single OnCompleted message.
|
1877
|
-
*
|
1881
|
+
*
|
1878
1882
|
* @example
|
1879
|
-
* var res = Rx.Observable.empty();
|
1880
|
-
* var res = Rx.Observable.empty(Rx.Scheduler.timeout);
|
1883
|
+
* var res = Rx.Observable.empty();
|
1884
|
+
* var res = Rx.Observable.empty(Rx.Scheduler.timeout);
|
1881
1885
|
* @param {Scheduler} [scheduler] Scheduler to send the termination call on.
|
1882
1886
|
* @returns {Observable} An observable sequence with no elements.
|
1883
1887
|
*/
|
@@ -1915,7 +1919,7 @@
|
|
1915
1919
|
var len = +o.length;
|
1916
1920
|
if (isNaN(len)) { return 0; }
|
1917
1921
|
if (len === 0 || !numberIsFinite(len)) { return len; }
|
1918
|
-
len = sign(len) * Math.floor(Math.abs(len));
|
1922
|
+
len = sign(len) * Math.floor(Math.abs(len));
|
1919
1923
|
if (len <= 0) { return 0; }
|
1920
1924
|
if (len > maxSafeInteger) { return maxSafeInteger; }
|
1921
1925
|
return len;
|
@@ -1967,7 +1971,7 @@
|
|
1967
1971
|
} catch (e) {
|
1968
1972
|
observer.onError(e);
|
1969
1973
|
return;
|
1970
|
-
}
|
1974
|
+
}
|
1971
1975
|
}
|
1972
1976
|
|
1973
1977
|
observer.onNext(result);
|
@@ -1979,9 +1983,10 @@
|
|
1979
1983
|
});
|
1980
1984
|
});
|
1981
1985
|
};
|
1986
|
+
|
1982
1987
|
/**
|
1983
1988
|
* Converts an array to an observable sequence, using an optional scheduler to enumerate the array.
|
1984
|
-
*
|
1989
|
+
*
|
1985
1990
|
* @example
|
1986
1991
|
* var res = Rx.Observable.fromArray([1,2,3]);
|
1987
1992
|
* var res = Rx.Observable.fromArray([1,2,3], Rx.Scheduler.timeout);
|
@@ -2026,7 +2031,7 @@
|
|
2026
2031
|
};
|
2027
2032
|
|
2028
2033
|
/**
|
2029
|
-
* This method creates a new Observable instance with a variable number of arguments, regardless of number or type of the arguments.
|
2034
|
+
* This method creates a new Observable instance with a variable number of arguments, regardless of number or type of the arguments.
|
2030
2035
|
* @example
|
2031
2036
|
* var res = Rx.Observable.of(1,2,3);
|
2032
2037
|
* @param {Scheduler} scheduler A scheduler to use for scheduling the arguments.
|
@@ -2040,7 +2045,7 @@
|
|
2040
2045
|
|
2041
2046
|
/**
|
2042
2047
|
* Generates an observable sequence of integral numbers within a specified range, using the specified scheduler to send out observer messages.
|
2043
|
-
*
|
2048
|
+
*
|
2044
2049
|
* @example
|
2045
2050
|
* var res = Rx.Observable.range(0, 10);
|
2046
2051
|
* var res = Rx.Observable.range(0, 10, Rx.Scheduler.timeout);
|
@@ -2065,7 +2070,7 @@
|
|
2065
2070
|
|
2066
2071
|
/**
|
2067
2072
|
* Generates an observable sequence that repeats the given element the specified number of times, using the specified scheduler to send out observer messages.
|
2068
|
-
*
|
2073
|
+
*
|
2069
2074
|
* @example
|
2070
2075
|
* var res = Rx.Observable.repeat(42);
|
2071
2076
|
* var res = Rx.Observable.repeat(42, 4);
|
@@ -2084,7 +2089,7 @@
|
|
2084
2089
|
/**
|
2085
2090
|
* Returns an observable sequence that contains a single element, using the specified scheduler to send out observer messages.
|
2086
2091
|
* There is an alias called 'just', and 'returnValue' for browsers <IE9.
|
2087
|
-
*
|
2092
|
+
*
|
2088
2093
|
* @example
|
2089
2094
|
* var res = Rx.Observable.return(42);
|
2090
2095
|
* var res = Rx.Observable.return(42, Rx.Scheduler.timeout);
|
@@ -2136,7 +2141,7 @@
|
|
2136
2141
|
subscription.setDisposable(d);
|
2137
2142
|
d.setDisposable(result.subscribe(observer));
|
2138
2143
|
}, observer.onCompleted.bind(observer)));
|
2139
|
-
|
2144
|
+
|
2140
2145
|
return subscription;
|
2141
2146
|
});
|
2142
2147
|
}
|
@@ -2148,25 +2153,21 @@
|
|
2148
2153
|
* 2 - xs.catchException(function (ex) { return ys(ex); })
|
2149
2154
|
* @param {Mixed} handlerOrSecond Exception handler function that returns an observable sequence given the error that occurred in the first sequence, or a second observable sequence used to produce results when an error occurred in the first sequence.
|
2150
2155
|
* @returns {Observable} An observable sequence containing the first sequence's elements, followed by the elements of the handler sequence in case an exception occurred.
|
2151
|
-
*/
|
2152
|
-
observableProto['catch'] = observableProto.catchException = function (handlerOrSecond) {
|
2156
|
+
*/
|
2157
|
+
observableProto['catch'] = observableProto.catchError = observableProto.catchException = function (handlerOrSecond) {
|
2153
2158
|
return typeof handlerOrSecond === 'function' ?
|
2154
2159
|
observableCatchHandler(this, handlerOrSecond) :
|
2155
2160
|
observableCatch([this, handlerOrSecond]);
|
2156
2161
|
};
|
2157
2162
|
|
2158
|
-
|
2159
|
-
|
2160
|
-
|
2161
|
-
|
2162
|
-
|
2163
|
-
|
2164
|
-
|
2165
|
-
|
2166
|
-
var observableCatch = Observable.catchException = Observable['catch'] = function () {
|
2167
|
-
var items = argsOrArray(arguments, 0);
|
2168
|
-
return enumerableFor(items).catchException();
|
2169
|
-
};
|
2163
|
+
/**
|
2164
|
+
* Continues an observable sequence that is terminated by an exception with the next observable sequence.
|
2165
|
+
* @param {Array | Arguments} args Arguments or an array to use as the next sequence if an error occurs.
|
2166
|
+
* @returns {Observable} An observable sequence containing elements from consecutive source sequences until a source sequence terminates successfully.
|
2167
|
+
*/
|
2168
|
+
var observableCatch = Observable.catchException = Observable.catchError = Observable['catch'] = function () {
|
2169
|
+
return enumerableOf(argsOrArray(arguments, 0)).catchException();
|
2170
|
+
};
|
2170
2171
|
|
2171
2172
|
/**
|
2172
2173
|
* Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences or Promises produces an element.
|
@@ -2175,7 +2176,7 @@
|
|
2175
2176
|
* @example
|
2176
2177
|
* 1 - obs = observable.combineLatest(obs1, obs2, obs3, function (o1, o2, o3) { return o1 + o2 + o3; });
|
2177
2178
|
* 2 - obs = observable.combineLatest([obs1, obs2, obs3], function (o1, o2, o3) { return o1 + o2 + o3; });
|
2178
|
-
* @returns {Observable} An observable sequence containing the result of combining elements of the sources using the specified result selector function.
|
2179
|
+
* @returns {Observable} An observable sequence containing the result of combining elements of the sources using the specified result selector function.
|
2179
2180
|
*/
|
2180
2181
|
observableProto.combineLatest = function () {
|
2181
2182
|
var args = slice.call(arguments);
|
@@ -2189,15 +2190,15 @@
|
|
2189
2190
|
|
2190
2191
|
/**
|
2191
2192
|
* Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences or Promises produces an element.
|
2192
|
-
*
|
2193
|
+
*
|
2193
2194
|
* @example
|
2194
2195
|
* 1 - obs = Rx.Observable.combineLatest(obs1, obs2, obs3, function (o1, o2, o3) { return o1 + o2 + o3; });
|
2195
|
-
* 2 - obs = Rx.Observable.combineLatest([obs1, obs2, obs3], function (o1, o2, o3) { return o1 + o2 + o3; });
|
2196
|
+
* 2 - obs = Rx.Observable.combineLatest([obs1, obs2, obs3], function (o1, o2, o3) { return o1 + o2 + o3; });
|
2196
2197
|
* @returns {Observable} An observable sequence containing the result of combining elements of the sources using the specified result selector function.
|
2197
2198
|
*/
|
2198
2199
|
var combineLatest = Observable.combineLatest = function () {
|
2199
2200
|
var args = slice.call(arguments), resultSelector = args.pop();
|
2200
|
-
|
2201
|
+
|
2201
2202
|
if (Array.isArray(args[0])) {
|
2202
2203
|
args = args[0];
|
2203
2204
|
}
|
@@ -2254,35 +2255,31 @@
|
|
2254
2255
|
|
2255
2256
|
/**
|
2256
2257
|
* Concatenates all the observable sequences. This takes in either an array or variable arguments to concatenate.
|
2257
|
-
*
|
2258
|
+
*
|
2258
2259
|
* @example
|
2259
2260
|
* 1 - concatenated = xs.concat(ys, zs);
|
2260
2261
|
* 2 - concatenated = xs.concat([ys, zs]);
|
2261
|
-
* @returns {Observable} An observable sequence that contains the elements of each given sequence, in sequential order.
|
2262
|
-
*/
|
2262
|
+
* @returns {Observable} An observable sequence that contains the elements of each given sequence, in sequential order.
|
2263
|
+
*/
|
2263
2264
|
observableProto.concat = function () {
|
2264
2265
|
var items = slice.call(arguments, 0);
|
2265
2266
|
items.unshift(this);
|
2266
2267
|
return observableConcat.apply(this, items);
|
2267
2268
|
};
|
2268
2269
|
|
2269
|
-
|
2270
|
-
|
2271
|
-
|
2272
|
-
|
2273
|
-
|
2274
|
-
|
2275
|
-
|
2276
|
-
|
2277
|
-
var observableConcat = Observable.concat = function () {
|
2278
|
-
var sources = argsOrArray(arguments, 0);
|
2279
|
-
return enumerableFor(sources).concat();
|
2280
|
-
};
|
2270
|
+
/**
|
2271
|
+
* Concatenates all the observable sequences.
|
2272
|
+
* @param {Array | Arguments} args Arguments or an array to concat to the observable sequence.
|
2273
|
+
* @returns {Observable} An observable sequence that contains the elements of each given sequence, in sequential order.
|
2274
|
+
*/
|
2275
|
+
var observableConcat = Observable.concat = function () {
|
2276
|
+
return enumerableOf(argsOrArray(arguments, 0)).concat();
|
2277
|
+
};
|
2281
2278
|
|
2282
2279
|
/**
|
2283
2280
|
* Concatenates an observable sequence of observable sequences.
|
2284
|
-
* @returns {Observable} An observable sequence that contains the elements of each observed inner sequence, in sequential order.
|
2285
|
-
*/
|
2281
|
+
* @returns {Observable} An observable sequence that contains the elements of each observed inner sequence, in sequential order.
|
2282
|
+
*/
|
2286
2283
|
observableProto.concatObservable = observableProto.concatAll =function () {
|
2287
2284
|
return this.merge(1);
|
2288
2285
|
};
|
@@ -2290,13 +2287,13 @@
|
|
2290
2287
|
/**
|
2291
2288
|
* Merges an observable sequence of observable sequences into an observable sequence, limiting the number of concurrent subscriptions to inner sequences.
|
2292
2289
|
* Or merges two observable sequences into a single observable sequence.
|
2293
|
-
*
|
2290
|
+
*
|
2294
2291
|
* @example
|
2295
2292
|
* 1 - merged = sources.merge(1);
|
2296
|
-
* 2 - merged = source.merge(otherSource);
|
2293
|
+
* 2 - merged = source.merge(otherSource);
|
2297
2294
|
* @param {Mixed} [maxConcurrentOrOther] Maximum number of inner observable sequences being subscribed to concurrently or the second observable sequence.
|
2298
|
-
* @returns {Observable} The observable sequence that merges the elements of the inner sequences.
|
2299
|
-
*/
|
2295
|
+
* @returns {Observable} The observable sequence that merges the elements of the inner sequences.
|
2296
|
+
*/
|
2300
2297
|
observableProto.merge = function (maxConcurrentOrOther) {
|
2301
2298
|
if (typeof maxConcurrentOrOther !== 'number') { return observableMerge(this, maxConcurrentOrOther); }
|
2302
2299
|
var sources = this;
|
@@ -2336,16 +2333,16 @@
|
|
2336
2333
|
};
|
2337
2334
|
|
2338
2335
|
/**
|
2339
|
-
* Merges all the observable sequences into a single observable sequence.
|
2336
|
+
* Merges all the observable sequences into a single observable sequence.
|
2340
2337
|
* The scheduler is optional and if not specified, the immediate scheduler is used.
|
2341
|
-
*
|
2338
|
+
*
|
2342
2339
|
* @example
|
2343
2340
|
* 1 - merged = Rx.Observable.merge(xs, ys, zs);
|
2344
2341
|
* 2 - merged = Rx.Observable.merge([xs, ys, zs]);
|
2345
2342
|
* 3 - merged = Rx.Observable.merge(scheduler, xs, ys, zs);
|
2346
|
-
* 4 - merged = Rx.Observable.merge(scheduler, [xs, ys, zs]);
|
2347
|
-
* @returns {Observable} The observable sequence that merges the elements of the observable sequences.
|
2348
|
-
*/
|
2343
|
+
* 4 - merged = Rx.Observable.merge(scheduler, [xs, ys, zs]);
|
2344
|
+
* @returns {Observable} The observable sequence that merges the elements of the observable sequences.
|
2345
|
+
*/
|
2349
2346
|
var observableMerge = Observable.merge = function () {
|
2350
2347
|
var scheduler, sources;
|
2351
2348
|
if (!arguments[0]) {
|
@@ -2362,13 +2359,13 @@
|
|
2362
2359
|
sources = sources[0];
|
2363
2360
|
}
|
2364
2361
|
return observableFromArray(sources, scheduler).mergeObservable();
|
2365
|
-
};
|
2362
|
+
};
|
2366
2363
|
|
2367
2364
|
/**
|
2368
2365
|
* Merges an observable sequence of observable sequences into an observable sequence.
|
2369
|
-
* @returns {Observable} The observable sequence that merges the elements of the inner sequences.
|
2370
|
-
*/
|
2371
|
-
observableProto.mergeObservable = observableProto.mergeAll =function () {
|
2366
|
+
* @returns {Observable} The observable sequence that merges the elements of the inner sequences.
|
2367
|
+
*/
|
2368
|
+
observableProto.mergeObservable = observableProto.mergeAll = function () {
|
2372
2369
|
var sources = this;
|
2373
2370
|
return new AnonymousObservable(function (observer) {
|
2374
2371
|
var group = new CompositeDisposable(),
|
@@ -2398,7 +2395,7 @@
|
|
2398
2395
|
/**
|
2399
2396
|
* Returns the values from the source observable sequence only after the other observable sequence produces a value.
|
2400
2397
|
* @param {Observable | Promise} other The observable sequence or Promise that triggers propagation of elements of the source sequence.
|
2401
|
-
* @returns {Observable} An observable sequence containing the elements of the source sequence starting from the point the other sequence triggered propagation.
|
2398
|
+
* @returns {Observable} An observable sequence containing the elements of the source sequence starting from the point the other sequence triggered propagation.
|
2402
2399
|
*/
|
2403
2400
|
observableProto.skipUntil = function (other) {
|
2404
2401
|
var source = this;
|
@@ -2427,7 +2424,7 @@
|
|
2427
2424
|
|
2428
2425
|
/**
|
2429
2426
|
* Transforms an observable sequence of observable sequences into an observable sequence producing values only from the most recent observable sequence.
|
2430
|
-
* @returns {Observable} The observable sequence that at any point in time produces the elements of the most recent inner observable sequence that has been received.
|
2427
|
+
* @returns {Observable} The observable sequence that at any point in time produces the elements of the most recent inner observable sequence that has been received.
|
2431
2428
|
*/
|
2432
2429
|
observableProto['switch'] = observableProto.switchLatest = function () {
|
2433
2430
|
var sources = this;
|
@@ -2446,16 +2443,16 @@
|
|
2446
2443
|
isPromise(innerSource) && (innerSource = observableFromPromise(innerSource));
|
2447
2444
|
|
2448
2445
|
d.setDisposable(innerSource.subscribe(
|
2449
|
-
function (x) { latest === id && observer.onNext(x); },
|
2450
|
-
function (e) { latest === id && observer.onError(e); },
|
2446
|
+
function (x) { latest === id && observer.onNext(x); },
|
2447
|
+
function (e) { latest === id && observer.onError(e); },
|
2451
2448
|
function () {
|
2452
2449
|
if (latest === id) {
|
2453
2450
|
hasLatest = false;
|
2454
2451
|
isStopped && observer.onCompleted();
|
2455
2452
|
}
|
2456
2453
|
}));
|
2457
|
-
},
|
2458
|
-
observer.onError.bind(observer),
|
2454
|
+
},
|
2455
|
+
observer.onError.bind(observer),
|
2459
2456
|
function () {
|
2460
2457
|
isStopped = true;
|
2461
2458
|
!hasLatest && observer.onCompleted();
|
@@ -2467,7 +2464,7 @@
|
|
2467
2464
|
/**
|
2468
2465
|
* Returns the values from the source observable sequence until the other observable sequence produces a value.
|
2469
2466
|
* @param {Observable | Promise} other Observable sequence or Promise that terminates propagation of elements of the source sequence.
|
2470
|
-
* @returns {Observable} An observable sequence containing the elements of the source sequence up to the point the other sequence interrupted further propagation.
|
2467
|
+
* @returns {Observable} An observable sequence containing the elements of the source sequence up to the point the other sequence interrupted further propagation.
|
2471
2468
|
*/
|
2472
2469
|
observableProto.takeUntil = function (other) {
|
2473
2470
|
var source = this;
|
@@ -2499,7 +2496,7 @@
|
|
2499
2496
|
}
|
2500
2497
|
}, observer.onError.bind(observer), observer.onCompleted.bind(observer));
|
2501
2498
|
});
|
2502
|
-
}
|
2499
|
+
}
|
2503
2500
|
|
2504
2501
|
/**
|
2505
2502
|
* Merges the specified observable sequences into one observable sequence by using the selector function whenever all of the observable sequences or an array have produced an element at a corresponding index.
|
@@ -2507,9 +2504,9 @@
|
|
2507
2504
|
*
|
2508
2505
|
* @example
|
2509
2506
|
* 1 - res = obs1.zip(obs2, fn);
|
2510
|
-
* 1 - res = x1.zip([1,2,3], fn);
|
2511
|
-
* @returns {Observable} An observable sequence containing the result of combining elements of the sources using the specified result selector function.
|
2512
|
-
*/
|
2507
|
+
* 1 - res = x1.zip([1,2,3], fn);
|
2508
|
+
* @returns {Observable} An observable sequence containing the result of combining elements of the sources using the specified result selector function.
|
2509
|
+
*/
|
2513
2510
|
observableProto.zip = function () {
|
2514
2511
|
if (Array.isArray(arguments[0])) {
|
2515
2512
|
return zipArray.apply(this, arguments);
|
@@ -2520,7 +2517,7 @@
|
|
2520
2517
|
var n = sources.length,
|
2521
2518
|
queues = arrayInitialize(n, function () { return []; }),
|
2522
2519
|
isDone = arrayInitialize(n, function () { return false; });
|
2523
|
-
|
2520
|
+
|
2524
2521
|
function next(i) {
|
2525
2522
|
var res, queuedValues;
|
2526
2523
|
if (queues.every(function (x) { return x.length > 0; })) {
|
@@ -2562,74 +2559,72 @@
|
|
2562
2559
|
return new CompositeDisposable(subscriptions);
|
2563
2560
|
});
|
2564
2561
|
};
|
2565
|
-
/**
|
2566
|
-
* Merges the specified observable sequences into one observable sequence by using the selector function whenever all of the observable sequences have produced an element at a corresponding index.
|
2567
|
-
* @param arguments Observable sources.
|
2568
|
-
* @param {Function} resultSelector Function to invoke for each series of elements at corresponding indexes in the sources.
|
2569
|
-
* @returns {Observable} An observable sequence containing the result of combining elements of the sources using the specified result selector function.
|
2570
|
-
*/
|
2571
|
-
Observable.zip = function () {
|
2572
|
-
var args = slice.call(arguments, 0),
|
2573
|
-
first = args.shift();
|
2574
|
-
return first.zip.apply(first, args);
|
2575
|
-
};
|
2576
2562
|
|
2577
|
-
|
2578
|
-
|
2579
|
-
|
2580
|
-
|
2581
|
-
|
2582
|
-
|
2583
|
-
|
2584
|
-
|
2585
|
-
|
2586
|
-
|
2587
|
-
isDone = arrayInitialize(n, function () { return false; });
|
2588
|
-
|
2589
|
-
function next(i) {
|
2590
|
-
if (queues.every(function (x) { return x.length > 0; })) {
|
2591
|
-
var res = queues.map(function (x) { return x.shift(); });
|
2592
|
-
observer.onNext(res);
|
2593
|
-
} else if (isDone.filter(function (x, j) { return j !== i; }).every(identity)) {
|
2594
|
-
observer.onCompleted();
|
2595
|
-
return;
|
2596
|
-
}
|
2597
|
-
};
|
2563
|
+
/**
|
2564
|
+
* Merges the specified observable sequences into one observable sequence by using the selector function whenever all of the observable sequences have produced an element at a corresponding index.
|
2565
|
+
* @param arguments Observable sources.
|
2566
|
+
* @param {Function} resultSelector Function to invoke for each series of elements at corresponding indexes in the sources.
|
2567
|
+
* @returns {Observable} An observable sequence containing the result of combining elements of the sources using the specified result selector function.
|
2568
|
+
*/
|
2569
|
+
Observable.zip = function () {
|
2570
|
+
var args = slice.call(arguments, 0), first = args.shift();
|
2571
|
+
return first.zip.apply(first, args);
|
2572
|
+
};
|
2598
2573
|
|
2599
|
-
|
2600
|
-
|
2601
|
-
|
2602
|
-
|
2603
|
-
|
2604
|
-
|
2605
|
-
|
2574
|
+
/**
|
2575
|
+
* Merges the specified observable sequences into one observable sequence by emitting a list with the elements of the observable sequences at corresponding indexes.
|
2576
|
+
* @param arguments Observable sources.
|
2577
|
+
* @returns {Observable} An observable sequence containing lists of elements at corresponding indexes.
|
2578
|
+
*/
|
2579
|
+
Observable.zipArray = function () {
|
2580
|
+
var sources = argsOrArray(arguments, 0);
|
2581
|
+
return new AnonymousObservable(function (observer) {
|
2582
|
+
var n = sources.length,
|
2583
|
+
queues = arrayInitialize(n, function () { return []; }),
|
2584
|
+
isDone = arrayInitialize(n, function () { return false; });
|
2606
2585
|
|
2607
|
-
|
2608
|
-
|
2609
|
-
|
2610
|
-
|
2611
|
-
|
2612
|
-
|
2613
|
-
|
2614
|
-
|
2615
|
-
|
2616
|
-
}));
|
2617
|
-
})(idx);
|
2618
|
-
}
|
2586
|
+
function next(i) {
|
2587
|
+
if (queues.every(function (x) { return x.length > 0; })) {
|
2588
|
+
var res = queues.map(function (x) { return x.shift(); });
|
2589
|
+
observer.onNext(res);
|
2590
|
+
} else if (isDone.filter(function (x, j) { return j !== i; }).every(identity)) {
|
2591
|
+
observer.onCompleted();
|
2592
|
+
return;
|
2593
|
+
}
|
2594
|
+
};
|
2619
2595
|
|
2620
|
-
|
2621
|
-
|
2622
|
-
|
2623
|
-
|
2624
|
-
|
2625
|
-
|
2626
|
-
|
2627
|
-
|
2628
|
-
|
2596
|
+
function done(i) {
|
2597
|
+
isDone[i] = true;
|
2598
|
+
if (isDone.every(identity)) {
|
2599
|
+
observer.onCompleted();
|
2600
|
+
return;
|
2601
|
+
}
|
2602
|
+
}
|
2603
|
+
|
2604
|
+
var subscriptions = new Array(n);
|
2605
|
+
for (var idx = 0; idx < n; idx++) {
|
2606
|
+
(function (i) {
|
2607
|
+
subscriptions[i] = new SingleAssignmentDisposable();
|
2608
|
+
subscriptions[i].setDisposable(sources[i].subscribe(function (x) {
|
2609
|
+
queues[i].push(x);
|
2610
|
+
next(i);
|
2611
|
+
}, observer.onError.bind(observer), function () {
|
2612
|
+
done(i);
|
2613
|
+
}));
|
2614
|
+
})(idx);
|
2615
|
+
}
|
2616
|
+
|
2617
|
+
var compositeDisposable = new CompositeDisposable(subscriptions);
|
2618
|
+
compositeDisposable.add(disposableCreate(function () {
|
2619
|
+
for (var qIdx = 0, qLen = queues.length; qIdx < qLen; qIdx++) { queues[qIdx] = []; }
|
2620
|
+
}));
|
2621
|
+
return compositeDisposable;
|
2622
|
+
});
|
2623
|
+
};
|
2629
2624
|
|
2630
2625
|
/**
|
2631
2626
|
* Hides the identity of an observable sequence.
|
2632
|
-
* @returns {Observable} An observable sequence that hides the identity of the source sequence.
|
2627
|
+
* @returns {Observable} An observable sequence that hides the identity of the source sequence.
|
2633
2628
|
*/
|
2634
2629
|
observableProto.asObservable = function () {
|
2635
2630
|
return new AnonymousObservable(this.subscribe.bind(this));
|
@@ -2638,7 +2633,7 @@
|
|
2638
2633
|
/**
|
2639
2634
|
* Dematerializes the explicit notification values of an observable sequence as implicit notifications.
|
2640
2635
|
* @returns {Observable} An observable sequence exhibiting the behavior corresponding to the source sequence's notification values.
|
2641
|
-
*/
|
2636
|
+
*/
|
2642
2637
|
observableProto.dematerialize = function () {
|
2643
2638
|
var source = this;
|
2644
2639
|
return new AnonymousObservable(function (observer) {
|
@@ -2650,14 +2645,14 @@
|
|
2650
2645
|
|
2651
2646
|
/**
|
2652
2647
|
* Returns an observable sequence that contains only distinct contiguous elements according to the keySelector and the comparer.
|
2653
|
-
*
|
2648
|
+
*
|
2654
2649
|
* var obs = observable.distinctUntilChanged();
|
2655
2650
|
* var obs = observable.distinctUntilChanged(function (x) { return x.id; });
|
2656
2651
|
* var obs = observable.distinctUntilChanged(function (x) { return x.id; }, function (x, y) { return x === y; });
|
2657
2652
|
*
|
2658
2653
|
* @param {Function} [keySelector] A function to compute the comparison key for each element. If not provided, it projects the value.
|
2659
2654
|
* @param {Function} [comparer] Equality comparer for computed key values. If not provided, defaults to an equality comparer function.
|
2660
|
-
* @returns {Observable} An observable sequence only containing the distinct contiguous elements, based on a computed key value, from the source sequence.
|
2655
|
+
* @returns {Observable} An observable sequence only containing the distinct contiguous elements, based on a computed key value, from the source sequence.
|
2661
2656
|
*/
|
2662
2657
|
observableProto.distinctUntilChanged = function (keySelector, comparer) {
|
2663
2658
|
var source = this;
|
@@ -2693,16 +2688,10 @@
|
|
2693
2688
|
/**
|
2694
2689
|
* Invokes an action for each element in the observable sequence and invokes an action upon graceful or exceptional termination of the observable sequence.
|
2695
2690
|
* This method can be used for debugging, logging, etc. of query behavior by intercepting the message stream to run arbitrary actions for messages on the pipeline.
|
2696
|
-
*
|
2697
|
-
* @example
|
2698
|
-
* var res = observable.do(observer);
|
2699
|
-
* var res = observable.do(onNext);
|
2700
|
-
* var res = observable.do(onNext, onError);
|
2701
|
-
* var res = observable.do(onNext, onError, onCompleted);
|
2702
2691
|
* @param {Function | Observer} observerOrOnNext Action to invoke for each element in the observable sequence or an observer.
|
2703
2692
|
* @param {Function} [onError] Action to invoke upon exceptional termination of the observable sequence. Used if only the observerOrOnNext parameter is also a function.
|
2704
2693
|
* @param {Function} [onCompleted] Action to invoke upon graceful termination of the observable sequence. Used if only the observerOrOnNext parameter is also a function.
|
2705
|
-
* @returns {Observable} The source sequence with the side-effecting behavior applied.
|
2694
|
+
* @returns {Observable} The source sequence with the side-effecting behavior applied.
|
2706
2695
|
*/
|
2707
2696
|
observableProto['do'] = observableProto.doAction = observableProto.tap = function (observerOrOnNext, onError, onCompleted) {
|
2708
2697
|
var source = this, onNextFunc;
|
@@ -2722,39 +2711,68 @@
|
|
2722
2711
|
}
|
2723
2712
|
observer.onNext(x);
|
2724
2713
|
}, function (err) {
|
2725
|
-
if (
|
2726
|
-
observer.onError(err);
|
2727
|
-
} else {
|
2714
|
+
if (onError) {
|
2728
2715
|
try {
|
2729
2716
|
onError(err);
|
2730
2717
|
} catch (e) {
|
2731
2718
|
observer.onError(e);
|
2732
2719
|
}
|
2733
|
-
observer.onError(err);
|
2734
2720
|
}
|
2721
|
+
observer.onError(err);
|
2735
2722
|
}, function () {
|
2736
|
-
if (
|
2737
|
-
observer.onCompleted();
|
2738
|
-
} else {
|
2723
|
+
if (onCompleted) {
|
2739
2724
|
try {
|
2740
2725
|
onCompleted();
|
2741
2726
|
} catch (e) {
|
2742
2727
|
observer.onError(e);
|
2743
2728
|
}
|
2744
|
-
observer.onCompleted();
|
2745
2729
|
}
|
2730
|
+
observer.onCompleted();
|
2746
2731
|
});
|
2747
2732
|
});
|
2748
2733
|
};
|
2749
2734
|
|
2735
|
+
/**
|
2736
|
+
* Invokes an action for each element in the observable sequence.
|
2737
|
+
* This method can be used for debugging, logging, etc. of query behavior by intercepting the message stream to run arbitrary actions for messages on the pipeline.
|
2738
|
+
* @param {Function} onNext Action to invoke for each element in the observable sequence.
|
2739
|
+
* @param {Any} [thisArg] Object to use as this when executing callback.
|
2740
|
+
* @returns {Observable} The source sequence with the side-effecting behavior applied.
|
2741
|
+
*/
|
2742
|
+
observableProto.doOnNext = observableProto.tapOnNext = function (onNext, thisArg) {
|
2743
|
+
return this.tap(arguments.length === 2 ? function (x) { onNext.call(thisArg, x); } : onNext);
|
2744
|
+
};
|
2745
|
+
|
2746
|
+
/**
|
2747
|
+
* Invokes an action upon exceptional termination of the observable sequence.
|
2748
|
+
* This method can be used for debugging, logging, etc. of query behavior by intercepting the message stream to run arbitrary actions for messages on the pipeline.
|
2749
|
+
* @param {Function} onError Action to invoke upon exceptional termination of the observable sequence.
|
2750
|
+
* @param {Any} [thisArg] Object to use as this when executing callback.
|
2751
|
+
* @returns {Observable} The source sequence with the side-effecting behavior applied.
|
2752
|
+
*/
|
2753
|
+
observableProto.doOnError = observableProto.tapOnError = function (onError, thisArg) {
|
2754
|
+
return this.tap(noop, arguments.length === 2 ? function (e) { onError.call(thisArg, e); } : onError);
|
2755
|
+
};
|
2756
|
+
|
2757
|
+
/**
|
2758
|
+
* Invokes an action upon graceful termination of the observable sequence.
|
2759
|
+
* This method can be used for debugging, logging, etc. of query behavior by intercepting the message stream to run arbitrary actions for messages on the pipeline.
|
2760
|
+
* @param {Function} onCompleted Action to invoke upon graceful termination of the observable sequence.
|
2761
|
+
* @param {Any} [thisArg] Object to use as this when executing callback.
|
2762
|
+
* @returns {Observable} The source sequence with the side-effecting behavior applied.
|
2763
|
+
*/
|
2764
|
+
observableProto.doOnCompleted = observableProto.tapOnCompleted = function (onCompleted, thisArg) {
|
2765
|
+
return this.tap(noop, null, arguments.length === 2 ? function () { onCompleted.call(thisArg); } : onCompleted);
|
2766
|
+
};
|
2767
|
+
|
2750
2768
|
/**
|
2751
2769
|
* Invokes a specified action after the source observable sequence terminates gracefully or exceptionally.
|
2752
|
-
*
|
2770
|
+
*
|
2753
2771
|
* @example
|
2754
2772
|
* var res = observable.finallyAction(function () { console.log('sequence ended'; });
|
2755
2773
|
* @param {Function} finallyAction Action to invoke after the source observable sequence terminates.
|
2756
|
-
* @returns {Observable} Source sequence with the action-invoking termination behavior applied.
|
2757
|
-
*/
|
2774
|
+
* @returns {Observable} Source sequence with the action-invoking termination behavior applied.
|
2775
|
+
*/
|
2758
2776
|
observableProto['finally'] = observableProto.finallyAction = function (action) {
|
2759
2777
|
var source = this;
|
2760
2778
|
return new AnonymousObservable(function (observer) {
|
@@ -2768,8 +2786,8 @@
|
|
2768
2786
|
return disposableCreate(function () {
|
2769
2787
|
try {
|
2770
2788
|
subscription.dispose();
|
2771
|
-
} catch (e) {
|
2772
|
-
throw e;
|
2789
|
+
} catch (e) {
|
2790
|
+
throw e;
|
2773
2791
|
} finally {
|
2774
2792
|
action();
|
2775
2793
|
}
|
@@ -2779,7 +2797,7 @@
|
|
2779
2797
|
|
2780
2798
|
/**
|
2781
2799
|
* Ignores all elements in an observable sequence leaving only the termination messages.
|
2782
|
-
* @returns {Observable} An empty observable sequence that signals termination, successful or exceptional, of the source sequence.
|
2800
|
+
* @returns {Observable} An empty observable sequence that signals termination, successful or exceptional, of the source sequence.
|
2783
2801
|
*/
|
2784
2802
|
observableProto.ignoreElements = function () {
|
2785
2803
|
var source = this;
|
@@ -2791,7 +2809,7 @@
|
|
2791
2809
|
/**
|
2792
2810
|
* Materializes the implicit notifications of an observable sequence as explicit notification values.
|
2793
2811
|
* @returns {Observable} An observable sequence containing the materialized notification values from the source sequence.
|
2794
|
-
*/
|
2812
|
+
*/
|
2795
2813
|
observableProto.materialize = function () {
|
2796
2814
|
var source = this;
|
2797
2815
|
return new AnonymousObservable(function (observer) {
|
@@ -2809,12 +2827,12 @@
|
|
2809
2827
|
|
2810
2828
|
/**
|
2811
2829
|
* Repeats the observable sequence a specified number of times. If the repeat count is not specified, the sequence repeats indefinitely.
|
2812
|
-
*
|
2830
|
+
*
|
2813
2831
|
* @example
|
2814
2832
|
* var res = repeated = source.repeat();
|
2815
2833
|
* var res = repeated = source.repeat(42);
|
2816
2834
|
* @param {Number} [repeatCount] Number of times to repeat the sequence. If not provided, repeats the sequence indefinitely.
|
2817
|
-
* @returns {Observable} The observable sequence producing the elements of the given sequence repeatedly.
|
2835
|
+
* @returns {Observable} The observable sequence producing the elements of the given sequence repeatedly.
|
2818
2836
|
*/
|
2819
2837
|
observableProto.repeat = function (repeatCount) {
|
2820
2838
|
return enumerableRepeat(this, repeatCount).concat();
|
@@ -2823,12 +2841,12 @@
|
|
2823
2841
|
/**
|
2824
2842
|
* Repeats the source observable sequence the specified number of times or until it successfully terminates. If the retry count is not specified, it retries indefinitely.
|
2825
2843
|
* Note if you encounter an error and want it to retry once, then you must use .retry(2);
|
2826
|
-
*
|
2844
|
+
*
|
2827
2845
|
* @example
|
2828
2846
|
* var res = retried = retry.repeat();
|
2829
2847
|
* var res = retried = retry.repeat(2);
|
2830
2848
|
* @param {Number} [retryCount] Number of times to retry the sequence. If not provided, retry the sequence indefinitely.
|
2831
|
-
* @returns {Observable} An observable sequence producing the elements of the given sequence repeatedly until it terminates successfully.
|
2849
|
+
* @returns {Observable} An observable sequence producing the elements of the given sequence repeatedly until it terminates successfully.
|
2832
2850
|
*/
|
2833
2851
|
observableProto.retry = function (retryCount) {
|
2834
2852
|
return enumerableRepeat(this, retryCount).catchException();
|
@@ -2849,7 +2867,7 @@
|
|
2849
2867
|
if (arguments.length === 2) {
|
2850
2868
|
hasSeed = true;
|
2851
2869
|
seed = arguments[0];
|
2852
|
-
accumulator = arguments[1];
|
2870
|
+
accumulator = arguments[1];
|
2853
2871
|
} else {
|
2854
2872
|
accumulator = arguments[0];
|
2855
2873
|
}
|
@@ -2864,7 +2882,7 @@
|
|
2864
2882
|
} else {
|
2865
2883
|
accumulation = hasSeed ? accumulator(seed, x) : x;
|
2866
2884
|
hasAccumulation = true;
|
2867
|
-
}
|
2885
|
+
}
|
2868
2886
|
} catch (e) {
|
2869
2887
|
observer.onError(e);
|
2870
2888
|
return;
|
@@ -2885,9 +2903,9 @@
|
|
2885
2903
|
* Bypasses a specified number of elements at the end of an observable sequence.
|
2886
2904
|
* @description
|
2887
2905
|
* This operator accumulates a queue with a length enough to store the first `count` elements. As more elements are
|
2888
|
-
* received, elements are taken from the front of the queue and produced on the result sequence. This causes elements to be delayed.
|
2906
|
+
* received, elements are taken from the front of the queue and produced on the result sequence. This causes elements to be delayed.
|
2889
2907
|
* @param count Number of elements to bypass at the end of the source sequence.
|
2890
|
-
* @returns {Observable} An observable sequence containing the source sequence elements except for the bypassed ones at the end.
|
2908
|
+
* @returns {Observable} An observable sequence containing the source sequence elements except for the bypassed ones at the end.
|
2891
2909
|
*/
|
2892
2910
|
observableProto.skipLast = function (count) {
|
2893
2911
|
var source = this;
|
@@ -2906,7 +2924,7 @@
|
|
2906
2924
|
* var res = source.startWith(1, 2, 3);
|
2907
2925
|
* var res = source.startWith(Rx.Scheduler.timeout, 1, 2, 3);
|
2908
2926
|
* @param {Arguments} args The specified values to prepend to the observable sequence
|
2909
|
-
* @returns {Observable} The source sequence prepended with the specified values.
|
2927
|
+
* @returns {Observable} The source sequence prepended with the specified values.
|
2910
2928
|
*/
|
2911
2929
|
observableProto.startWith = function () {
|
2912
2930
|
var values, scheduler, start = 0;
|
@@ -2917,7 +2935,7 @@
|
|
2917
2935
|
scheduler = immediateScheduler;
|
2918
2936
|
}
|
2919
2937
|
values = slice.call(arguments, start);
|
2920
|
-
return
|
2938
|
+
return enumerableOf([observableFromArray(values, scheduler), this]).concat();
|
2921
2939
|
};
|
2922
2940
|
|
2923
2941
|
/**
|
@@ -2927,7 +2945,7 @@
|
|
2927
2945
|
* the source sequence, this buffer is drained on the result sequence. This causes the elements to be delayed.
|
2928
2946
|
* @param {Number} count Number of elements to take from the end of the source sequence.
|
2929
2947
|
* @returns {Observable} An observable sequence containing the specified number of elements from the end of the source sequence.
|
2930
|
-
*/
|
2948
|
+
*/
|
2931
2949
|
observableProto.takeLast = function (count) {
|
2932
2950
|
var source = this;
|
2933
2951
|
return new AnonymousObservable(function (observer) {
|
@@ -2952,21 +2970,21 @@
|
|
2952
2970
|
/**
|
2953
2971
|
* One of the Following:
|
2954
2972
|
* Projects each element of an observable sequence to an observable sequence and merges the resulting observable sequences into one observable sequence.
|
2955
|
-
*
|
2973
|
+
*
|
2956
2974
|
* @example
|
2957
2975
|
* var res = source.concatMap(function (x) { return Rx.Observable.range(0, x); });
|
2958
2976
|
* Or:
|
2959
2977
|
* 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.
|
2960
|
-
*
|
2978
|
+
*
|
2961
2979
|
* var res = source.concatMap(function (x) { return Rx.Observable.range(0, x); }, function (x, y) { return x + y; });
|
2962
2980
|
* Or:
|
2963
2981
|
* Projects each element of the source observable sequence to the other observable sequence and merges the resulting observable sequences into one observable sequence.
|
2964
|
-
*
|
2982
|
+
*
|
2965
2983
|
* var res = source.concatMap(Rx.Observable.fromArray([1,2,3]));
|
2966
|
-
* @param selector A transform function to apply to each element or an observable sequence to project each element from the
|
2984
|
+
* @param selector A transform function to apply to each element or an observable sequence to project each element from the
|
2967
2985
|
* source sequence onto which could be either an observable or Promise.
|
2968
2986
|
* @param {Function} [resultSelector] A transform function to apply to each element of the intermediate sequence.
|
2969
|
-
* @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.
|
2987
|
+
* @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.
|
2970
2988
|
*/
|
2971
2989
|
observableProto.selectConcat = observableProto.concatMap = function (selector, resultSelector, thisArg) {
|
2972
2990
|
if (resultSelector) {
|
@@ -2974,39 +2992,39 @@
|
|
2974
2992
|
var selectorResult = selector(x, i),
|
2975
2993
|
result = isPromise(selectorResult) ? observableFromPromise(selectorResult) : selectorResult;
|
2976
2994
|
|
2977
|
-
return result.map(function (y) {
|
2978
|
-
return resultSelector(x, y, i);
|
2979
|
-
});
|
2980
|
-
});
|
2981
|
-
}
|
2982
|
-
return typeof selector === 'function' ?
|
2983
|
-
concatMap(this, selector, thisArg) :
|
2984
|
-
concatMap(this, function () { return selector; });
|
2985
|
-
};
|
2986
|
-
|
2987
|
-
/**
|
2988
|
-
* Projects each element of an observable sequence into a new form by incorporating the element's index.
|
2989
|
-
* @param {Function} selector A transform function to apply to each source element; the second parameter of the function represents the index of the source element.
|
2990
|
-
* @param {Any} [thisArg] Object to use as this when executing callback.
|
2991
|
-
* @returns {Observable} An observable sequence whose elements are the result of invoking the transform function on each element of source.
|
2992
|
-
*/
|
2993
|
-
observableProto.select = observableProto.map = function (selector, thisArg) {
|
2994
|
-
var parent = this;
|
2995
|
-
return new AnonymousObservable(function (observer) {
|
2996
|
-
var count = 0;
|
2997
|
-
return parent.subscribe(function (value) {
|
2998
|
-
var result;
|
2999
|
-
try {
|
3000
|
-
result = selector.call(thisArg, value, count++, parent);
|
3001
|
-
} catch (exception) {
|
3002
|
-
observer.onError(exception);
|
3003
|
-
return;
|
3004
|
-
}
|
3005
|
-
observer.onNext(result);
|
3006
|
-
}, observer.onError.bind(observer), observer.onCompleted.bind(observer));
|
3007
|
-
});
|
2995
|
+
return result.map(function (y) {
|
2996
|
+
return resultSelector(x, y, i);
|
2997
|
+
});
|
2998
|
+
});
|
2999
|
+
}
|
3000
|
+
return typeof selector === 'function' ?
|
3001
|
+
concatMap(this, selector, thisArg) :
|
3002
|
+
concatMap(this, function () { return selector; });
|
3008
3003
|
};
|
3009
3004
|
|
3005
|
+
/**
|
3006
|
+
* Projects each element of an observable sequence into a new form by incorporating the element's index.
|
3007
|
+
* @param {Function} selector A transform function to apply to each source element; the second parameter of the function represents the index of the source element.
|
3008
|
+
* @param {Any} [thisArg] Object to use as this when executing callback.
|
3009
|
+
* @returns {Observable} An observable sequence whose elements are the result of invoking the transform function on each element of source.
|
3010
|
+
*/
|
3011
|
+
observableProto.select = observableProto.map = function (selector, thisArg) {
|
3012
|
+
var parent = this;
|
3013
|
+
return new AnonymousObservable(function (observer) {
|
3014
|
+
var count = 0;
|
3015
|
+
return parent.subscribe(function (value) {
|
3016
|
+
var result;
|
3017
|
+
try {
|
3018
|
+
result = selector.call(thisArg, value, count++, parent);
|
3019
|
+
} catch (e) {
|
3020
|
+
observer.onError(e);
|
3021
|
+
return;
|
3022
|
+
}
|
3023
|
+
observer.onNext(result);
|
3024
|
+
}, observer.onError.bind(observer), observer.onCompleted.bind(observer));
|
3025
|
+
});
|
3026
|
+
};
|
3027
|
+
|
3010
3028
|
/**
|
3011
3029
|
* Retrieves the value of a specified property from all elements in the Observable sequence.
|
3012
3030
|
* @param {String} prop The property to pluck.
|
@@ -3026,22 +3044,22 @@
|
|
3026
3044
|
/**
|
3027
3045
|
* One of the Following:
|
3028
3046
|
* Projects each element of an observable sequence to an observable sequence and merges the resulting observable sequences into one observable sequence.
|
3029
|
-
*
|
3047
|
+
*
|
3030
3048
|
* @example
|
3031
3049
|
* var res = source.selectMany(function (x) { return Rx.Observable.range(0, x); });
|
3032
3050
|
* Or:
|
3033
3051
|
* 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.
|
3034
|
-
*
|
3052
|
+
*
|
3035
3053
|
* var res = source.selectMany(function (x) { return Rx.Observable.range(0, x); }, function (x, y) { return x + y; });
|
3036
3054
|
* Or:
|
3037
3055
|
* Projects each element of the source observable sequence to the other observable sequence and merges the resulting observable sequences into one observable sequence.
|
3038
|
-
*
|
3056
|
+
*
|
3039
3057
|
* var res = source.selectMany(Rx.Observable.fromArray([1,2,3]));
|
3040
|
-
* @param selector A transform function to apply to each element or an observable sequence to project each element from the
|
3058
|
+
* @param selector A transform function to apply to each element or an observable sequence to project each element from the
|
3041
3059
|
* source sequence onto which could be either an observable or Promise.
|
3042
3060
|
* @param {Function} [resultSelector] A transform function to apply to each element of the intermediate sequence.
|
3043
3061
|
* @param {Any} [thisArg] Object to use as this when executing callback.
|
3044
|
-
* @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.
|
3062
|
+
* @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.
|
3045
3063
|
*/
|
3046
3064
|
observableProto.selectMany = observableProto.flatMap = function (selector, resultSelector, thisArg) {
|
3047
3065
|
if (resultSelector) {
|
@@ -3060,11 +3078,11 @@
|
|
3060
3078
|
};
|
3061
3079
|
|
3062
3080
|
/**
|
3063
|
-
* Projects each element of an observable sequence into a new sequence of observable sequences by incorporating the element's index and then
|
3081
|
+
* Projects each element of an observable sequence into a new sequence of observable sequences by incorporating the element's index and then
|
3064
3082
|
* transforms an observable sequence of observable sequences into an observable sequence producing values only from the most recent observable sequence.
|
3065
3083
|
* @param {Function} selector A transform function to apply to each source element; the second parameter of the function represents the index of the source element.
|
3066
3084
|
* @param {Any} [thisArg] Object to use as this when executing callback.
|
3067
|
-
* @returns {Observable} An observable sequence whose elements are the result of invoking the transform function on each element of source producing an Observable of Observable sequences
|
3085
|
+
* @returns {Observable} An observable sequence whose elements are the result of invoking the transform function on each element of source producing an Observable of Observable sequences
|
3068
3086
|
* and that at any point in time produces the elements of the most recent inner observable sequence that has been received.
|
3069
3087
|
*/
|
3070
3088
|
observableProto.selectSwitch = observableProto.flatMapLatest = observableProto.switchMap = function (selector, thisArg) {
|
@@ -3074,7 +3092,7 @@
|
|
3074
3092
|
/**
|
3075
3093
|
* Bypasses a specified number of elements in an observable sequence and then returns the remaining elements.
|
3076
3094
|
* @param {Number} count The number of elements to skip before returning the remaining elements.
|
3077
|
-
* @returns {Observable} An observable sequence that contains the elements that occur after the specified index in the input sequence.
|
3095
|
+
* @returns {Observable} An observable sequence that contains the elements that occur after the specified index in the input sequence.
|
3078
3096
|
*/
|
3079
3097
|
observableProto.skip = function (count) {
|
3080
3098
|
if (count < 0) { throw new Error(argumentOutOfRange); }
|
@@ -3094,12 +3112,12 @@
|
|
3094
3112
|
/**
|
3095
3113
|
* Bypasses elements in an observable sequence as long as a specified condition is true and then returns the remaining elements.
|
3096
3114
|
* The element's index is used in the logic of the predicate function.
|
3097
|
-
*
|
3115
|
+
*
|
3098
3116
|
* var res = source.skipWhile(function (value) { return value < 10; });
|
3099
3117
|
* var res = source.skipWhile(function (value, index) { return value < 10 || index < 10; });
|
3100
3118
|
* @param {Function} predicate A function to test each element for a condition; the second parameter of the function represents the index of the source element.
|
3101
|
-
* @param {Any} [thisArg] Object to use as this when executing callback.
|
3102
|
-
* @returns {Observable} An observable sequence that contains the elements from the input sequence starting at the first element in the linear series that does not pass the test specified by predicate.
|
3119
|
+
* @param {Any} [thisArg] Object to use as this when executing callback.
|
3120
|
+
* @returns {Observable} An observable sequence that contains the elements from the input sequence starting at the first element in the linear series that does not pass the test specified by predicate.
|
3103
3121
|
*/
|
3104
3122
|
observableProto.skipWhile = function (predicate, thisArg) {
|
3105
3123
|
var source = this;
|
@@ -3121,12 +3139,12 @@
|
|
3121
3139
|
|
3122
3140
|
/**
|
3123
3141
|
* Returns a specified number of contiguous elements from the start of an observable sequence, using the specified scheduler for the edge case of take(0).
|
3124
|
-
*
|
3142
|
+
*
|
3125
3143
|
* var res = source.take(5);
|
3126
3144
|
* var res = source.take(0, Rx.Scheduler.timeout);
|
3127
3145
|
* @param {Number} count The number of elements to return.
|
3128
3146
|
* @param {Scheduler} [scheduler] Scheduler used to produce an OnCompleted message in case <paramref name="count count</paramref> is set to 0.
|
3129
|
-
* @returns {Observable} An observable sequence that contains the specified number of elements from the start of the input sequence.
|
3147
|
+
* @returns {Observable} An observable sequence that contains the specified number of elements from the start of the input sequence.
|
3130
3148
|
*/
|
3131
3149
|
observableProto.take = function (count, scheduler) {
|
3132
3150
|
if (count < 0) { throw new RangeError(argumentOutOfRange); }
|
@@ -3147,8 +3165,8 @@
|
|
3147
3165
|
* Returns elements from an observable sequence as long as a specified condition is true.
|
3148
3166
|
* The element's index is used in the logic of the predicate function.
|
3149
3167
|
* @param {Function} predicate A function to test each element for a condition; the second parameter of the function represents the index of the source element.
|
3150
|
-
* @param {Any} [thisArg] Object to use as this when executing callback.
|
3151
|
-
* @returns {Observable} An observable sequence that contains the elements from the input sequence that occur before the element at which the test no longer passes.
|
3168
|
+
* @param {Any} [thisArg] Object to use as this when executing callback.
|
3169
|
+
* @returns {Observable} An observable sequence that contains the elements from the input sequence that occur before the element at which the test no longer passes.
|
3152
3170
|
*/
|
3153
3171
|
observableProto.takeWhile = function (predicate, thisArg) {
|
3154
3172
|
var observable = this;
|
@@ -3172,38 +3190,36 @@
|
|
3172
3190
|
});
|
3173
3191
|
};
|
3174
3192
|
|
3175
|
-
|
3176
|
-
|
3177
|
-
|
3178
|
-
|
3179
|
-
|
3180
|
-
|
3181
|
-
|
3182
|
-
|
3183
|
-
|
3184
|
-
|
3185
|
-
|
3186
|
-
|
3187
|
-
|
3188
|
-
|
3189
|
-
|
3190
|
-
|
3191
|
-
|
3192
|
-
|
3193
|
-
|
3194
|
-
|
3195
|
-
|
3196
|
-
|
3197
|
-
|
3198
|
-
|
3199
|
-
|
3200
|
-
|
3201
|
-
});
|
3202
|
-
};
|
3193
|
+
/**
|
3194
|
+
* Filters the elements of an observable sequence based on a predicate by incorporating the element's index.
|
3195
|
+
*
|
3196
|
+
* @example
|
3197
|
+
* var res = source.where(function (value) { return value < 10; });
|
3198
|
+
* var res = source.where(function (value, index) { return value < 10 || index < 10; });
|
3199
|
+
* @param {Function} predicate A function to test each source element for a condition; the second parameter of the function represents the index of the source element.
|
3200
|
+
* @param {Any} [thisArg] Object to use as this when executing callback.
|
3201
|
+
* @returns {Observable} An observable sequence that contains elements from the input sequence that satisfy the condition.
|
3202
|
+
*/
|
3203
|
+
observableProto.where = observableProto.filter = function (predicate, thisArg) {
|
3204
|
+
var parent = this;
|
3205
|
+
return new AnonymousObservable(function (observer) {
|
3206
|
+
var count = 0;
|
3207
|
+
return parent.subscribe(function (value) {
|
3208
|
+
var shouldRun;
|
3209
|
+
try {
|
3210
|
+
shouldRun = predicate.call(thisArg, value, count++, parent);
|
3211
|
+
} catch (e) {
|
3212
|
+
observer.onError(e);
|
3213
|
+
return;
|
3214
|
+
}
|
3215
|
+
shouldRun && observer.onNext(value);
|
3216
|
+
}, observer.onError.bind(observer), observer.onCompleted.bind(observer));
|
3217
|
+
});
|
3218
|
+
};
|
3203
3219
|
|
3204
3220
|
/**
|
3205
|
-
* Converts a callback function to an observable sequence.
|
3206
|
-
*
|
3221
|
+
* Converts a callback function to an observable sequence.
|
3222
|
+
*
|
3207
3223
|
* @param {Function} function Function with a callback as the last parameter to convert to an Observable sequence.
|
3208
3224
|
* @param {Mixed} [context] The context for the func parameter to be executed. If not specified, defaults to undefined.
|
3209
3225
|
* @param {Function} [selector] A selector which takes the arguments from the callback to produce a single item to yield on next.
|
@@ -3216,7 +3232,7 @@
|
|
3216
3232
|
return new AnonymousObservable(function (observer) {
|
3217
3233
|
function handler(e) {
|
3218
3234
|
var results = e;
|
3219
|
-
|
3235
|
+
|
3220
3236
|
if (selector) {
|
3221
3237
|
try {
|
3222
3238
|
results = selector(arguments);
|
@@ -3227,13 +3243,13 @@
|
|
3227
3243
|
|
3228
3244
|
observer.onNext(results);
|
3229
3245
|
} else {
|
3230
|
-
if (results.length <= 1) {
|
3246
|
+
if (results.length <= 1) {
|
3231
3247
|
observer.onNext.apply(observer, results);
|
3232
3248
|
} else {
|
3233
3249
|
observer.onNext(results);
|
3234
3250
|
}
|
3235
3251
|
}
|
3236
|
-
|
3252
|
+
|
3237
3253
|
observer.onCompleted();
|
3238
3254
|
}
|
3239
3255
|
|
@@ -3247,7 +3263,7 @@
|
|
3247
3263
|
* Converts a Node.js callback style function to an observable sequence. This must be in function (err, ...) format.
|
3248
3264
|
* @param {Function} func The function to call
|
3249
3265
|
* @param {Mixed} [context] The context for the func parameter to be executed. If not specified, defaults to undefined.
|
3250
|
-
* @param {Function} [selector] A selector which takes the arguments from the callback minus the error to produce a single item to yield on next.
|
3266
|
+
* @param {Function} [selector] A selector which takes the arguments from the callback minus the error to produce a single item to yield on next.
|
3251
3267
|
* @returns {Function} An async function which when applied, returns an observable sequence with the callback arguments as an array.
|
3252
3268
|
*/
|
3253
3269
|
Observable.fromNodeCallback = function (func, context, selector) {
|
@@ -3262,7 +3278,7 @@
|
|
3262
3278
|
}
|
3263
3279
|
|
3264
3280
|
var results = slice.call(arguments, 1);
|
3265
|
-
|
3281
|
+
|
3266
3282
|
if (selector) {
|
3267
3283
|
try {
|
3268
3284
|
results = selector(results);
|
@@ -3272,7 +3288,7 @@
|
|
3272
3288
|
}
|
3273
3289
|
observer.onNext(results);
|
3274
3290
|
} else {
|
3275
|
-
if (results.length <= 1) {
|
3291
|
+
if (results.length <= 1) {
|
3276
3292
|
observer.onNext.apply(observer, results);
|
3277
3293
|
} else {
|
3278
3294
|
observer.onNext(results);
|
@@ -3314,7 +3330,7 @@
|
|
3314
3330
|
}
|
3315
3331
|
|
3316
3332
|
/**
|
3317
|
-
* Configuration option to determine whether to use native events only
|
3333
|
+
* Configuration option to determine whether to use native events only
|
3318
3334
|
*/
|
3319
3335
|
Rx.config.useNativeEvents = false;
|
3320
3336
|
|
@@ -3326,7 +3342,7 @@
|
|
3326
3342
|
|
3327
3343
|
// Check for ember
|
3328
3344
|
var ember = !!root.Ember && typeof root.Ember.addListener === 'function';
|
3329
|
-
|
3345
|
+
|
3330
3346
|
// Check for Backbone.Marionette. Note if using AMD add Marionette as a dependency of rxjs
|
3331
3347
|
// for proper loading order!
|
3332
3348
|
var marionette = !!root.Backbone && !!root.Backbone.Marionette;
|
@@ -3336,10 +3352,10 @@
|
|
3336
3352
|
*
|
3337
3353
|
* @example
|
3338
3354
|
* var source = Rx.Observable.fromEvent(element, 'mouseup');
|
3339
|
-
*
|
3355
|
+
*
|
3340
3356
|
* @param {Object} element The DOMElement or NodeList to attach a listener.
|
3341
3357
|
* @param {String} eventName The event name to attach the observable sequence.
|
3342
|
-
* @param {Function} [selector] A selector which takes the arguments from the event handler to produce a single item to yield on next.
|
3358
|
+
* @param {Function} [selector] A selector which takes the arguments from the event handler to produce a single item to yield on next.
|
3343
3359
|
* @returns {Observable} An observable sequence of events from the specified element and the specified event.
|
3344
3360
|
*/
|
3345
3361
|
Observable.fromEvent = function (element, eventName, selector) {
|
@@ -3349,8 +3365,8 @@
|
|
3349
3365
|
function (h) { element.addListener(eventName, h); },
|
3350
3366
|
function (h) { element.removeListener(eventName, h); },
|
3351
3367
|
selector);
|
3352
|
-
}
|
3353
|
-
|
3368
|
+
}
|
3369
|
+
|
3354
3370
|
// Use only if non-native events are allowed
|
3355
3371
|
if (!Rx.config.useNativeEvents) {
|
3356
3372
|
if (marionette) {
|
@@ -3364,7 +3380,7 @@
|
|
3364
3380
|
function (h) { Ember.addListener(element, eventName, h); },
|
3365
3381
|
function (h) { Ember.removeListener(element, eventName, h); },
|
3366
3382
|
selector);
|
3367
|
-
}
|
3383
|
+
}
|
3368
3384
|
if (jq) {
|
3369
3385
|
var $elem = jq(element);
|
3370
3386
|
return fromEventPattern(
|
@@ -3375,9 +3391,9 @@
|
|
3375
3391
|
}
|
3376
3392
|
return new AnonymousObservable(function (observer) {
|
3377
3393
|
return createEventListener(
|
3378
|
-
element,
|
3379
|
-
eventName,
|
3380
|
-
function handler (e) {
|
3394
|
+
element,
|
3395
|
+
eventName,
|
3396
|
+
function handler (e) {
|
3381
3397
|
var results = e;
|
3382
3398
|
|
3383
3399
|
if (selector) {
|
@@ -3389,7 +3405,7 @@
|
|
3389
3405
|
}
|
3390
3406
|
}
|
3391
3407
|
|
3392
|
-
observer.onNext(results);
|
3408
|
+
observer.onNext(results);
|
3393
3409
|
});
|
3394
3410
|
}).publish().refCount();
|
3395
3411
|
};
|
@@ -3446,11 +3462,12 @@
|
|
3446
3462
|
return subject;
|
3447
3463
|
});
|
3448
3464
|
};
|
3465
|
+
|
3449
3466
|
/*
|
3450
3467
|
* Converts an existing observable sequence to an ES6 Compatible Promise
|
3451
3468
|
* @example
|
3452
3469
|
* var promise = Rx.Observable.return(42).toPromise(RSVP.Promise);
|
3453
|
-
*
|
3470
|
+
*
|
3454
3471
|
* // With config
|
3455
3472
|
* Rx.config.Promise = RSVP.Promise;
|
3456
3473
|
* var promise = Rx.Observable.return(42).toPromise();
|
@@ -3472,6 +3489,7 @@
|
|
3472
3489
|
});
|
3473
3490
|
});
|
3474
3491
|
};
|
3492
|
+
|
3475
3493
|
/**
|
3476
3494
|
* Invokes the asynchronous function, surfacing the result through an observable sequence.
|
3477
3495
|
* @param {Function} functionAsync Asynchronous function which returns a Promise to run.
|
@@ -3491,16 +3509,16 @@
|
|
3491
3509
|
* Multicasts the source sequence notifications through an instantiated subject into all uses of the sequence within a selector function. Each
|
3492
3510
|
* subscription to the resulting sequence causes a separate multicast invocation, exposing the sequence resulting from the selector function's
|
3493
3511
|
* invocation. For specializations with fixed subject types, see Publish, PublishLast, and Replay.
|
3494
|
-
*
|
3512
|
+
*
|
3495
3513
|
* @example
|
3496
3514
|
* 1 - res = source.multicast(observable);
|
3497
3515
|
* 2 - res = source.multicast(function () { return new Subject(); }, function (x) { return x; });
|
3498
|
-
*
|
3499
|
-
* @param {Function|Subject} subjectOrSubjectSelector
|
3516
|
+
*
|
3517
|
+
* @param {Function|Subject} subjectOrSubjectSelector
|
3500
3518
|
* Factory function to create an intermediate subject through which the source sequence's elements will be multicast to the selector function.
|
3501
3519
|
* Or:
|
3502
3520
|
* Subject to push source elements into.
|
3503
|
-
*
|
3521
|
+
*
|
3504
3522
|
* @param {Function} [selector] Optional selector function which can use the multicasted source sequence subject to the policies enforced by the created subject. Specified only if <paramref name="subjectOrSubjectSelector" is a factory function.
|
3505
3523
|
* @returns {Observable} An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.
|
3506
3524
|
*/
|
@@ -3517,11 +3535,11 @@
|
|
3517
3535
|
/**
|
3518
3536
|
* Returns an observable sequence that is the result of invoking the selector on a connectable observable sequence that shares a single subscription to the underlying sequence.
|
3519
3537
|
* This operator is a specialization of Multicast using a regular Subject.
|
3520
|
-
*
|
3538
|
+
*
|
3521
3539
|
* @example
|
3522
3540
|
* var resres = source.publish();
|
3523
3541
|
* var res = source.publish(function (x) { return x; });
|
3524
|
-
*
|
3542
|
+
*
|
3525
3543
|
* @param {Function} [selector] Selector function which can use the multicasted source sequence as many times as needed, without causing multiple subscriptions to the source sequence. Subscribers to the given source will receive all notifications of the source from the time of the subscription on.
|
3526
3544
|
* @returns {Observable} An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.
|
3527
3545
|
*/
|
@@ -3534,10 +3552,10 @@
|
|
3534
3552
|
/**
|
3535
3553
|
* Returns an observable sequence that shares a single subscription to the underlying sequence.
|
3536
3554
|
* This operator is a specialization of publish which creates a subscription when the number of observers goes from zero to one, then shares that subscription with all subsequent observers until the number of observers returns to zero, at which point the subscription is disposed.
|
3537
|
-
*
|
3555
|
+
*
|
3538
3556
|
* @example
|
3539
3557
|
* var res = source.share();
|
3540
|
-
*
|
3558
|
+
*
|
3541
3559
|
* @returns {Observable} An observable sequence that contains the elements of a sequence produced by multicasting the source sequence.
|
3542
3560
|
*/
|
3543
3561
|
observableProto.share = function () {
|
@@ -3547,11 +3565,11 @@
|
|
3547
3565
|
/**
|
3548
3566
|
* Returns an observable sequence that is the result of invoking the selector on a connectable observable sequence that shares a single subscription to the underlying sequence containing only the last notification.
|
3549
3567
|
* This operator is a specialization of Multicast using a AsyncSubject.
|
3550
|
-
*
|
3568
|
+
*
|
3551
3569
|
* @example
|
3552
3570
|
* var res = source.publishLast();
|
3553
3571
|
* var res = source.publishLast(function (x) { return x; });
|
3554
|
-
*
|
3572
|
+
*
|
3555
3573
|
* @param selector [Optional] Selector function which can use the multicasted source sequence as many times as needed, without causing multiple subscriptions to the source sequence. Subscribers to the given source will only receive the last notification of the source.
|
3556
3574
|
* @returns {Observable} An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.
|
3557
3575
|
*/
|
@@ -3564,11 +3582,11 @@
|
|
3564
3582
|
/**
|
3565
3583
|
* Returns an observable sequence that is the result of invoking the selector on a connectable observable sequence that shares a single subscription to the underlying sequence and starts with initialValue.
|
3566
3584
|
* This operator is a specialization of Multicast using a BehaviorSubject.
|
3567
|
-
*
|
3585
|
+
*
|
3568
3586
|
* @example
|
3569
3587
|
* var res = source.publishValue(42);
|
3570
3588
|
* var res = source.publishValue(function (x) { return x.select(function (y) { return y * y; }) }, 42);
|
3571
|
-
*
|
3589
|
+
*
|
3572
3590
|
* @param {Function} [selector] Optional selector function which can use the multicasted source sequence as many times as needed, without causing multiple subscriptions to the source sequence. Subscribers to the given source will receive immediately receive the initial value, followed by all notifications of the source from the time of the subscription on.
|
3573
3591
|
* @param {Mixed} initialValue Initial value received by observers upon subscription.
|
3574
3592
|
* @returns {Observable} An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.
|
@@ -3584,10 +3602,10 @@
|
|
3584
3602
|
/**
|
3585
3603
|
* Returns an observable sequence that shares a single subscription to the underlying sequence and starts with an initialValue.
|
3586
3604
|
* This operator is a specialization of publishValue which creates a subscription when the number of observers goes from zero to one, then shares that subscription with all subsequent observers until the number of observers returns to zero, at which point the subscription is disposed.
|
3587
|
-
*
|
3605
|
+
*
|
3588
3606
|
* @example
|
3589
3607
|
* var res = source.shareValue(42);
|
3590
|
-
*
|
3608
|
+
*
|
3591
3609
|
* @param {Mixed} initialValue Initial value received by observers upon subscription.
|
3592
3610
|
* @returns {Observable} An observable sequence that contains the elements of a sequence produced by multicasting the source sequence.
|
3593
3611
|
*/
|
@@ -3598,13 +3616,13 @@
|
|
3598
3616
|
/**
|
3599
3617
|
* Returns an observable sequence that is the result of invoking the selector on a connectable observable sequence that shares a single subscription to the underlying sequence replaying notifications subject to a maximum time length for the replay buffer.
|
3600
3618
|
* This operator is a specialization of Multicast using a ReplaySubject.
|
3601
|
-
*
|
3619
|
+
*
|
3602
3620
|
* @example
|
3603
3621
|
* var res = source.replay(null, 3);
|
3604
3622
|
* var res = source.replay(null, 3, 500);
|
3605
3623
|
* var res = source.replay(null, 3, 500, scheduler);
|
3606
3624
|
* var res = source.replay(function (x) { return x.take(6).repeat(); }, 3, 500, scheduler);
|
3607
|
-
*
|
3625
|
+
*
|
3608
3626
|
* @param selector [Optional] Selector function which can use the multicasted source sequence as many times as needed, without causing multiple subscriptions to the source sequence. Subscribers to the given source will receive all the notifications of the source subject to the specified replay buffer trimming policy.
|
3609
3627
|
* @param bufferSize [Optional] Maximum element count of the replay buffer.
|
3610
3628
|
* @param window [Optional] Maximum time length of the replay buffer.
|
@@ -3620,12 +3638,12 @@
|
|
3620
3638
|
/**
|
3621
3639
|
* Returns an observable sequence that shares a single subscription to the underlying sequence replaying notifications subject to a maximum time length for the replay buffer.
|
3622
3640
|
* This operator is a specialization of replay which creates a subscription when the number of observers goes from zero to one, then shares that subscription with all subsequent observers until the number of observers returns to zero, at which point the subscription is disposed.
|
3623
|
-
*
|
3641
|
+
*
|
3624
3642
|
* @example
|
3625
3643
|
* var res = source.shareReplay(3);
|
3626
3644
|
* var res = source.shareReplay(3, 500);
|
3627
3645
|
* var res = source.shareReplay(3, 500, scheduler);
|
3628
|
-
*
|
3646
|
+
*
|
3629
3647
|
|
3630
3648
|
* @param bufferSize [Optional] Maximum element count of the replay buffer.
|
3631
3649
|
* @param window [Optional] Maximum time length of the replay buffer.
|
@@ -3636,42 +3654,43 @@
|
|
3636
3654
|
return this.replay(null, bufferSize, window, scheduler).refCount();
|
3637
3655
|
};
|
3638
3656
|
|
3639
|
-
var ConnectableObservable = Rx.ConnectableObservable = (function (__super__) {
|
3640
|
-
inherits(ConnectableObservable, __super__);
|
3641
|
-
|
3642
|
-
function ConnectableObservable(source, subject) {
|
3643
|
-
var hasSubscription = false,
|
3644
|
-
subscription,
|
3645
|
-
sourceObservable = source.asObservable();
|
3646
|
-
|
3647
|
-
this.connect = function () {
|
3648
|
-
if (!hasSubscription) {
|
3649
|
-
hasSubscription = true;
|
3650
|
-
subscription = new CompositeDisposable(sourceObservable.subscribe(subject), disposableCreate(function () {
|
3651
|
-
hasSubscription = false;
|
3652
|
-
}));
|
3653
|
-
}
|
3654
|
-
return subscription;
|
3655
|
-
};
|
3656
|
-
|
3657
|
-
__super__.call(this, subject.subscribe.bind(subject));
|
3658
|
-
}
|
3659
|
-
|
3660
|
-
ConnectableObservable.prototype.refCount = function () {
|
3661
|
-
var connectableSubscription, count = 0, source = this;
|
3662
|
-
return new AnonymousObservable(function (observer) {
|
3663
|
-
var shouldConnect = ++count === 1,
|
3664
|
-
subscription = source.subscribe(observer);
|
3665
|
-
shouldConnect && (connectableSubscription = source.connect());
|
3666
|
-
return function () {
|
3667
|
-
subscription.dispose();
|
3668
|
-
--count === 0 && connectableSubscription.dispose();
|
3669
|
-
};
|
3670
|
-
});
|
3671
|
-
};
|
3672
|
-
|
3673
|
-
return ConnectableObservable;
|
3657
|
+
var ConnectableObservable = Rx.ConnectableObservable = (function (__super__) {
|
3658
|
+
inherits(ConnectableObservable, __super__);
|
3659
|
+
|
3660
|
+
function ConnectableObservable(source, subject) {
|
3661
|
+
var hasSubscription = false,
|
3662
|
+
subscription,
|
3663
|
+
sourceObservable = source.asObservable();
|
3664
|
+
|
3665
|
+
this.connect = function () {
|
3666
|
+
if (!hasSubscription) {
|
3667
|
+
hasSubscription = true;
|
3668
|
+
subscription = new CompositeDisposable(sourceObservable.subscribe(subject), disposableCreate(function () {
|
3669
|
+
hasSubscription = false;
|
3670
|
+
}));
|
3671
|
+
}
|
3672
|
+
return subscription;
|
3673
|
+
};
|
3674
|
+
|
3675
|
+
__super__.call(this, subject.subscribe.bind(subject));
|
3676
|
+
}
|
3677
|
+
|
3678
|
+
ConnectableObservable.prototype.refCount = function () {
|
3679
|
+
var connectableSubscription, count = 0, source = this;
|
3680
|
+
return new AnonymousObservable(function (observer) {
|
3681
|
+
var shouldConnect = ++count === 1,
|
3682
|
+
subscription = source.subscribe(observer);
|
3683
|
+
shouldConnect && (connectableSubscription = source.connect());
|
3684
|
+
return function () {
|
3685
|
+
subscription.dispose();
|
3686
|
+
--count === 0 && connectableSubscription.dispose();
|
3687
|
+
};
|
3688
|
+
});
|
3689
|
+
};
|
3690
|
+
|
3691
|
+
return ConnectableObservable;
|
3674
3692
|
}(Observable));
|
3693
|
+
|
3675
3694
|
function observableTimerDate(dueTime, scheduler) {
|
3676
3695
|
return new AnonymousObservable(function (observer) {
|
3677
3696
|
return scheduler.scheduleWithAbsolute(dueTime, function () {
|
@@ -3720,11 +3739,11 @@
|
|
3720
3739
|
|
3721
3740
|
/**
|
3722
3741
|
* Returns an observable sequence that produces a value after each period.
|
3723
|
-
*
|
3742
|
+
*
|
3724
3743
|
* @example
|
3725
3744
|
* 1 - res = Rx.Observable.interval(1000);
|
3726
3745
|
* 2 - res = Rx.Observable.interval(1000, Rx.Scheduler.timeout);
|
3727
|
-
*
|
3746
|
+
*
|
3728
3747
|
* @param {Number} period Period for producing the values in the resulting sequence (specified as an integer denoting milliseconds).
|
3729
3748
|
* @param {Scheduler} [scheduler] Scheduler to run the timer on. If not specified, Rx.Scheduler.timeout is used.
|
3730
3749
|
* @returns {Observable} An observable sequence that produces a value after each period.
|
@@ -3832,11 +3851,11 @@
|
|
3832
3851
|
|
3833
3852
|
/**
|
3834
3853
|
* Time shifts the observable sequence by dueTime. The relative time intervals between the values are preserved.
|
3835
|
-
*
|
3854
|
+
*
|
3836
3855
|
* @example
|
3837
3856
|
* 1 - res = Rx.Observable.delay(new Date());
|
3838
3857
|
* 2 - res = Rx.Observable.delay(new Date(), Rx.Scheduler.timeout);
|
3839
|
-
*
|
3858
|
+
*
|
3840
3859
|
* 3 - res = Rx.Observable.delay(5000);
|
3841
3860
|
* 4 - res = Rx.Observable.delay(5000, 1000, Rx.Scheduler.timeout);
|
3842
3861
|
* @memberOf Observable#
|
@@ -3853,11 +3872,11 @@
|
|
3853
3872
|
|
3854
3873
|
/**
|
3855
3874
|
* Ignores values from an observable sequence which are followed by another value before dueTime.
|
3856
|
-
*
|
3875
|
+
*
|
3857
3876
|
* @example
|
3858
3877
|
* 1 - res = source.throttle(5000); // 5 seconds
|
3859
|
-
* 2 - res = source.throttle(5000, scheduler);
|
3860
|
-
*
|
3878
|
+
* 2 - res = source.throttle(5000, scheduler);
|
3879
|
+
*
|
3861
3880
|
* @param {Number} dueTime Duration of the throttle period for each value (specified as an integer denoting milliseconds).
|
3862
3881
|
* @param {Scheduler} [scheduler] Scheduler to run the throttle timers on. If not specified, the timeout scheduler is used.
|
3863
3882
|
* @returns {Observable} The throttled sequence.
|
@@ -3876,16 +3895,16 @@
|
|
3876
3895
|
d = new SingleAssignmentDisposable();
|
3877
3896
|
cancelable.setDisposable(d);
|
3878
3897
|
d.setDisposable(scheduler.scheduleWithRelative(dueTime, function () {
|
3879
|
-
|
3898
|
+
hasvalue && id === currentId && observer.onNext(value);
|
3880
3899
|
hasvalue = false;
|
3881
3900
|
}));
|
3882
|
-
},
|
3901
|
+
},
|
3883
3902
|
function (e) {
|
3884
3903
|
cancelable.dispose();
|
3885
3904
|
observer.onError(e);
|
3886
3905
|
hasvalue = false;
|
3887
3906
|
id++;
|
3888
|
-
},
|
3907
|
+
},
|
3889
3908
|
function () {
|
3890
3909
|
cancelable.dispose();
|
3891
3910
|
hasvalue && observer.onNext(value);
|
@@ -3899,11 +3918,11 @@
|
|
3899
3918
|
|
3900
3919
|
/**
|
3901
3920
|
* Records the timestamp for each value in an observable sequence.
|
3902
|
-
*
|
3921
|
+
*
|
3903
3922
|
* @example
|
3904
3923
|
* 1 - res = source.timestamp(); // produces { value: x, timestamp: ts }
|
3905
3924
|
* 2 - res = source.timestamp(Rx.Scheduler.timeout);
|
3906
|
-
*
|
3925
|
+
*
|
3907
3926
|
* @param {Scheduler} [scheduler] Scheduler used to compute timestamps. If not specified, the timeout scheduler is used.
|
3908
3927
|
* @returns {Observable} An observable sequence with timestamp information on values.
|
3909
3928
|
*/
|
@@ -3915,7 +3934,7 @@
|
|
3915
3934
|
};
|
3916
3935
|
|
3917
3936
|
function sampleObservable(source, sampler) {
|
3918
|
-
|
3937
|
+
|
3919
3938
|
return new AnonymousObservable(function (observer) {
|
3920
3939
|
var atEnd, value, hasValue;
|
3921
3940
|
|
@@ -3941,12 +3960,12 @@
|
|
3941
3960
|
|
3942
3961
|
/**
|
3943
3962
|
* Samples the observable sequence at each interval.
|
3944
|
-
*
|
3963
|
+
*
|
3945
3964
|
* @example
|
3946
3965
|
* 1 - res = source.sample(sampleObservable); // Sampler tick sequence
|
3947
3966
|
* 2 - res = source.sample(5000); // 5 seconds
|
3948
3967
|
* 2 - res = source.sample(5000, Rx.Scheduler.timeout); // 5 seconds
|
3949
|
-
*
|
3968
|
+
*
|
3950
3969
|
* @param {Mixed} intervalOrSampler Interval at which to sample (specified as an integer denoting milliseconds) or Sampler Observable.
|
3951
3970
|
* @param {Scheduler} [scheduler] Scheduler to run the sampling timer on. If not specified, the timeout scheduler is used.
|
3952
3971
|
* @returns {Observable} Sampled observable sequence.
|
@@ -3959,7 +3978,7 @@
|
|
3959
3978
|
};
|
3960
3979
|
|
3961
3980
|
/**
|
3962
|
-
* Returns the source observable sequence or the other observable sequence if dueTime elapses.
|
3981
|
+
* Returns the source observable sequence or the other observable sequence if dueTime elapses.
|
3963
3982
|
* @param {Number} dueTime Absolute (specified as a Date object) or relative time (specified as an integer denoting milliseconds) when a timeout occurs.
|
3964
3983
|
* @param {Observable} [other] Sequence to return in case of a timeout. If not specified, a timeout error throwing sequence will be used.
|
3965
3984
|
* @param {Scheduler} [scheduler] Scheduler to run the timeout timers on. If not specified, the timeout scheduler is used.
|
@@ -3968,7 +3987,7 @@
|
|
3968
3987
|
observableProto.timeout = function (dueTime, other, scheduler) {
|
3969
3988
|
other || (other = observableThrow(new Error('Timeout')));
|
3970
3989
|
isScheduler(scheduler) || (scheduler = timeoutScheduler);
|
3971
|
-
|
3990
|
+
|
3972
3991
|
var source = this, schedulerMethod = dueTime instanceof Date ?
|
3973
3992
|
'scheduleWithAbsolute' :
|
3974
3993
|
'scheduleWithRelative';
|
@@ -3993,7 +4012,7 @@
|
|
3993
4012
|
}
|
3994
4013
|
|
3995
4014
|
createTimer();
|
3996
|
-
|
4015
|
+
|
3997
4016
|
original.setDisposable(source.subscribe(function (x) {
|
3998
4017
|
if (!switched) {
|
3999
4018
|
id++;
|
@@ -4015,199 +4034,6 @@
|
|
4015
4034
|
});
|
4016
4035
|
};
|
4017
4036
|
|
4018
|
-
/**
|
4019
|
-
* Time shifts the observable sequence by delaying the subscription.
|
4020
|
-
*
|
4021
|
-
* @example
|
4022
|
-
* 1 - res = source.delaySubscription(5000); // 5s
|
4023
|
-
* 2 - res = source.delaySubscription(5000, Rx.Scheduler.timeout); // 5 seconds
|
4024
|
-
*
|
4025
|
-
* @param {Number} dueTime Absolute or relative time to perform the subscription at.
|
4026
|
-
* @param {Scheduler} [scheduler] Scheduler to run the subscription delay timer on. If not specified, the timeout scheduler is used.
|
4027
|
-
* @returns {Observable} Time-shifted sequence.
|
4028
|
-
*/
|
4029
|
-
observableProto.delaySubscription = function (dueTime, scheduler) {
|
4030
|
-
return this.delayWithSelector(observableTimer(dueTime, isScheduler(scheduler) ? scheduler : timeoutScheduler), observableEmpty);
|
4031
|
-
};
|
4032
|
-
|
4033
|
-
/**
|
4034
|
-
* Time shifts the observable sequence based on a subscription delay and a delay selector function for each element.
|
4035
|
-
*
|
4036
|
-
* @example
|
4037
|
-
* 1 - res = source.delayWithSelector(function (x) { return Rx.Scheduler.timer(5000); }); // with selector only
|
4038
|
-
* 1 - res = source.delayWithSelector(Rx.Observable.timer(2000), function (x) { return Rx.Observable.timer(x); }); // with delay and selector
|
4039
|
-
*
|
4040
|
-
* @param {Observable} [subscriptionDelay] Sequence indicating the delay for the subscription to the source.
|
4041
|
-
* @param {Function} delayDurationSelector Selector function to retrieve a sequence indicating the delay for each given element.
|
4042
|
-
* @returns {Observable} Time-shifted sequence.
|
4043
|
-
*/
|
4044
|
-
observableProto.delayWithSelector = function (subscriptionDelay, delayDurationSelector) {
|
4045
|
-
var source = this, subDelay, selector;
|
4046
|
-
if (typeof subscriptionDelay === 'function') {
|
4047
|
-
selector = subscriptionDelay;
|
4048
|
-
} else {
|
4049
|
-
subDelay = subscriptionDelay;
|
4050
|
-
selector = delayDurationSelector;
|
4051
|
-
}
|
4052
|
-
return new AnonymousObservable(function (observer) {
|
4053
|
-
var delays = new CompositeDisposable(), atEnd = false, done = function () {
|
4054
|
-
if (atEnd && delays.length === 0) {
|
4055
|
-
observer.onCompleted();
|
4056
|
-
}
|
4057
|
-
}, subscription = new SerialDisposable(), start = function () {
|
4058
|
-
subscription.setDisposable(source.subscribe(function (x) {
|
4059
|
-
var delay;
|
4060
|
-
try {
|
4061
|
-
delay = selector(x);
|
4062
|
-
} catch (error) {
|
4063
|
-
observer.onError(error);
|
4064
|
-
return;
|
4065
|
-
}
|
4066
|
-
var d = new SingleAssignmentDisposable();
|
4067
|
-
delays.add(d);
|
4068
|
-
d.setDisposable(delay.subscribe(function () {
|
4069
|
-
observer.onNext(x);
|
4070
|
-
delays.remove(d);
|
4071
|
-
done();
|
4072
|
-
}, observer.onError.bind(observer), function () {
|
4073
|
-
observer.onNext(x);
|
4074
|
-
delays.remove(d);
|
4075
|
-
done();
|
4076
|
-
}));
|
4077
|
-
}, observer.onError.bind(observer), function () {
|
4078
|
-
atEnd = true;
|
4079
|
-
subscription.dispose();
|
4080
|
-
done();
|
4081
|
-
}));
|
4082
|
-
};
|
4083
|
-
|
4084
|
-
if (!subDelay) {
|
4085
|
-
start();
|
4086
|
-
} else {
|
4087
|
-
subscription.setDisposable(subDelay.subscribe(function () {
|
4088
|
-
start();
|
4089
|
-
}, observer.onError.bind(observer), function () { start(); }));
|
4090
|
-
}
|
4091
|
-
|
4092
|
-
return new CompositeDisposable(subscription, delays);
|
4093
|
-
});
|
4094
|
-
};
|
4095
|
-
|
4096
|
-
/**
|
4097
|
-
* Skips elements for the specified duration from the end of the observable source sequence, using the specified scheduler to run timers.
|
4098
|
-
*
|
4099
|
-
* 1 - res = source.skipLastWithTime(5000);
|
4100
|
-
* 2 - res = source.skipLastWithTime(5000, scheduler);
|
4101
|
-
*
|
4102
|
-
* @description
|
4103
|
-
* This operator accumulates a queue with a length enough to store elements received during the initial duration window.
|
4104
|
-
* As more elements are received, elements older than the specified duration are taken from the queue and produced on the
|
4105
|
-
* result sequence. This causes elements to be delayed with duration.
|
4106
|
-
* @param {Number} duration Duration for skipping elements from the end of the sequence.
|
4107
|
-
* @param {Scheduler} [scheduler] Scheduler to run the timer on. If not specified, defaults to Rx.Scheduler.timeout
|
4108
|
-
* @returns {Observable} An observable sequence with the elements skipped during the specified duration from the end of the source sequence.
|
4109
|
-
*/
|
4110
|
-
observableProto.skipLastWithTime = function (duration, scheduler) {
|
4111
|
-
isScheduler(scheduler) || (scheduler = timeoutScheduler);
|
4112
|
-
var source = this;
|
4113
|
-
return new AnonymousObservable(function (observer) {
|
4114
|
-
var q = [];
|
4115
|
-
return source.subscribe(function (x) {
|
4116
|
-
var now = scheduler.now();
|
4117
|
-
q.push({ interval: now, value: x });
|
4118
|
-
while (q.length > 0 && now - q[0].interval >= duration) {
|
4119
|
-
observer.onNext(q.shift().value);
|
4120
|
-
}
|
4121
|
-
}, observer.onError.bind(observer), function () {
|
4122
|
-
var now = scheduler.now();
|
4123
|
-
while (q.length > 0 && now - q[0].interval >= duration) {
|
4124
|
-
observer.onNext(q.shift().value);
|
4125
|
-
}
|
4126
|
-
observer.onCompleted();
|
4127
|
-
});
|
4128
|
-
});
|
4129
|
-
};
|
4130
|
-
|
4131
|
-
/**
|
4132
|
-
* Returns elements within the specified duration from the end of the observable source sequence, using the specified schedulers to run timers and to drain the collected elements.
|
4133
|
-
* @description
|
4134
|
-
* This operator accumulates a queue with a length enough to store elements received during the initial duration window.
|
4135
|
-
* As more elements are received, elements older than the specified duration are taken from the queue and produced on the
|
4136
|
-
* result sequence. This causes elements to be delayed with duration.
|
4137
|
-
* @param {Number} duration Duration for taking elements from the end of the sequence.
|
4138
|
-
* @param {Scheduler} [scheduler] Scheduler to run the timer on. If not specified, defaults to Rx.Scheduler.timeout.
|
4139
|
-
* @returns {Observable} An observable sequence with the elements taken during the specified duration from the end of the source sequence.
|
4140
|
-
*/
|
4141
|
-
observableProto.takeLastWithTime = function (duration, scheduler) {
|
4142
|
-
var source = this;
|
4143
|
-
isScheduler(scheduler) || (scheduler = timeoutScheduler);
|
4144
|
-
return new AnonymousObservable(function (observer) {
|
4145
|
-
var q = [];
|
4146
|
-
return source.subscribe(function (x) {
|
4147
|
-
var now = scheduler.now();
|
4148
|
-
q.push({ interval: now, value: x });
|
4149
|
-
while (q.length > 0 && now - q[0].interval >= duration) {
|
4150
|
-
q.shift();
|
4151
|
-
}
|
4152
|
-
}, observer.onError.bind(observer), function () {
|
4153
|
-
var now = scheduler.now();
|
4154
|
-
while (q.length > 0) {
|
4155
|
-
var next = q.shift();
|
4156
|
-
if (now - next.interval <= duration) { observer.onNext(next.value); }
|
4157
|
-
}
|
4158
|
-
observer.onCompleted();
|
4159
|
-
});
|
4160
|
-
});
|
4161
|
-
};
|
4162
|
-
|
4163
|
-
/**
|
4164
|
-
* Takes elements for the specified duration from the start of the observable source sequence, using the specified scheduler to run timers.
|
4165
|
-
*
|
4166
|
-
* @example
|
4167
|
-
* 1 - res = source.takeWithTime(5000, [optional scheduler]);
|
4168
|
-
* @description
|
4169
|
-
* This operator accumulates a queue with a length enough to store elements received during the initial duration window.
|
4170
|
-
* As more elements are received, elements older than the specified duration are taken from the queue and produced on the
|
4171
|
-
* result sequence. This causes elements to be delayed with duration.
|
4172
|
-
* @param {Number} duration Duration for taking elements from the start of the sequence.
|
4173
|
-
* @param {Scheduler} scheduler Scheduler to run the timer on. If not specified, defaults to Rx.Scheduler.timeout.
|
4174
|
-
* @returns {Observable} An observable sequence with the elements taken during the specified duration from the start of the source sequence.
|
4175
|
-
*/
|
4176
|
-
observableProto.takeWithTime = function (duration, scheduler) {
|
4177
|
-
var source = this;
|
4178
|
-
isScheduler(scheduler) || (scheduler = timeoutScheduler);
|
4179
|
-
return new AnonymousObservable(function (observer) {
|
4180
|
-
return new CompositeDisposable(scheduler.scheduleWithRelative(duration, observer.onCompleted.bind(observer)), source.subscribe(observer));
|
4181
|
-
});
|
4182
|
-
};
|
4183
|
-
|
4184
|
-
/**
|
4185
|
-
* Skips elements for the specified duration from the start of the observable source sequence, using the specified scheduler to run timers.
|
4186
|
-
*
|
4187
|
-
* @example
|
4188
|
-
* 1 - res = source.skipWithTime(5000, [optional scheduler]);
|
4189
|
-
*
|
4190
|
-
* @description
|
4191
|
-
* Specifying a zero value for duration doesn't guarantee no elements will be dropped from the start of the source sequence.
|
4192
|
-
* This is a side-effect of the asynchrony introduced by the scheduler, where the action that causes callbacks from the source sequence to be forwarded
|
4193
|
-
* may not execute immediately, despite the zero due time.
|
4194
|
-
*
|
4195
|
-
* Errors produced by the source sequence are always forwarded to the result sequence, even if the error occurs before the duration.
|
4196
|
-
* @param {Number} duration Duration for skipping elements from the start of the sequence.
|
4197
|
-
* @param {Scheduler} scheduler Scheduler to run the timer on. If not specified, defaults to Rx.Scheduler.timeout.
|
4198
|
-
* @returns {Observable} An observable sequence with the elements skipped during the specified duration from the start of the source sequence.
|
4199
|
-
*/
|
4200
|
-
observableProto.skipWithTime = function (duration, scheduler) {
|
4201
|
-
var source = this;
|
4202
|
-
isScheduler(scheduler) || (scheduler = timeoutScheduler);
|
4203
|
-
return new AnonymousObservable(function (observer) {
|
4204
|
-
var open = false;
|
4205
|
-
return new CompositeDisposable(
|
4206
|
-
scheduler.scheduleWithRelative(duration, function () { open = true; }),
|
4207
|
-
source.subscribe(function (x) { open && observer.onNext(x); }, observer.onError.bind(observer), observer.onCompleted.bind(observer)));
|
4208
|
-
});
|
4209
|
-
};
|
4210
|
-
|
4211
4037
|
var PausableObservable = (function (_super) {
|
4212
4038
|
|
4213
4039
|
inherits(PausableObservable, _super);
|
@@ -4265,6 +4091,7 @@
|
|
4265
4091
|
observableProto.pausable = function (pauser) {
|
4266
4092
|
return new PausableObservable(this, pauser);
|
4267
4093
|
};
|
4094
|
+
|
4268
4095
|
function combineLatestSource(source, subject, resultSelector) {
|
4269
4096
|
return new AnonymousObservable(function (observer) {
|
4270
4097
|
var n = 2,
|
@@ -4315,13 +4142,13 @@
|
|
4315
4142
|
|
4316
4143
|
function subscribe(observer) {
|
4317
4144
|
var q = [], previousShouldFire;
|
4318
|
-
|
4319
|
-
var subscription =
|
4145
|
+
|
4146
|
+
var subscription =
|
4320
4147
|
combineLatestSource(
|
4321
4148
|
this.source,
|
4322
4149
|
this.pauser.distinctUntilChanged().startWith(false),
|
4323
4150
|
function (data, shouldFire) {
|
4324
|
-
return { data: data, shouldFire: shouldFire };
|
4151
|
+
return { data: data, shouldFire: shouldFire };
|
4325
4152
|
})
|
4326
4153
|
.subscribe(
|
4327
4154
|
function (results) {
|
@@ -4355,10 +4182,10 @@
|
|
4355
4182
|
while (q.length > 0) {
|
4356
4183
|
observer.onNext(q.shift());
|
4357
4184
|
}
|
4358
|
-
observer.onCompleted();
|
4185
|
+
observer.onCompleted();
|
4359
4186
|
}
|
4360
4187
|
);
|
4361
|
-
return subscription;
|
4188
|
+
return subscription;
|
4362
4189
|
}
|
4363
4190
|
|
4364
4191
|
function PausableBufferedObservable(source, pauser) {
|
@@ -4382,7 +4209,7 @@
|
|
4382
4209
|
this.controller.onNext(true);
|
4383
4210
|
};
|
4384
4211
|
|
4385
|
-
return PausableBufferedObservable;
|
4212
|
+
return PausableBufferedObservable;
|
4386
4213
|
|
4387
4214
|
}(Observable));
|
4388
4215
|
|
@@ -4394,7 +4221,7 @@
|
|
4394
4221
|
* var source = Rx.Observable.interval(100).pausableBuffered(pauser);
|
4395
4222
|
* @param {Observable} pauser The observable sequence used to pause the underlying sequence.
|
4396
4223
|
* @returns {Observable} The observable sequence which is paused based upon the pauser.
|
4397
|
-
*/
|
4224
|
+
*/
|
4398
4225
|
observableProto.pausableBuffered = function (subject) {
|
4399
4226
|
return new PausableBufferedObservable(this, subject);
|
4400
4227
|
};
|
@@ -4406,11 +4233,12 @@
|
|
4406
4233
|
* source.request(3); // Reads 3 values
|
4407
4234
|
* @param {Observable} pauser The observable sequence used to pause the underlying sequence.
|
4408
4235
|
* @returns {Observable} The observable sequence which is paused based upon the pauser.
|
4409
|
-
*/
|
4236
|
+
*/
|
4410
4237
|
observableProto.controlled = function (enableQueue) {
|
4411
4238
|
if (enableQueue == null) { enableQueue = true; }
|
4412
4239
|
return new ControlledObservable(this, enableQueue);
|
4413
4240
|
};
|
4241
|
+
|
4414
4242
|
var ControlledObservable = (function (_super) {
|
4415
4243
|
|
4416
4244
|
inherits(ControlledObservable, _super);
|
@@ -4475,7 +4303,7 @@
|
|
4475
4303
|
|
4476
4304
|
if (!this.enableQueue || this.queue.length === 0) {
|
4477
4305
|
this.subject.onError(error);
|
4478
|
-
}
|
4306
|
+
}
|
4479
4307
|
},
|
4480
4308
|
onNext: function (value) {
|
4481
4309
|
checkDisposed.call(this);
|
@@ -4522,7 +4350,7 @@
|
|
4522
4350
|
} else if (this.hasCompleted) {
|
4523
4351
|
this.subject.onCompleted();
|
4524
4352
|
this.controlledDisposable.dispose();
|
4525
|
-
this.controlledDisposable = disposableEmpty;
|
4353
|
+
this.controlledDisposable = disposableEmpty;
|
4526
4354
|
}
|
4527
4355
|
|
4528
4356
|
return { numberOfItems: numberOfItems, returnValue: false };
|
@@ -4560,6 +4388,7 @@
|
|
4560
4388
|
|
4561
4389
|
return ControlledSubject;
|
4562
4390
|
}(Observable));
|
4391
|
+
|
4563
4392
|
/*
|
4564
4393
|
* Performs a exclusive waiting for the first to finish before subscribing to another observable.
|
4565
4394
|
* Observables that come in between subscriptions will be dropped on the floor.
|
@@ -4579,7 +4408,7 @@
|
|
4579
4408
|
function (innerSource) {
|
4580
4409
|
if (!hasCurrent) {
|
4581
4410
|
hasCurrent = true;
|
4582
|
-
|
4411
|
+
|
4583
4412
|
isPromise(innerSource) && (innerSource = observableFromPromise(innerSource));
|
4584
4413
|
|
4585
4414
|
var innerSubscription = new SingleAssignmentDisposable();
|
@@ -4600,7 +4429,7 @@
|
|
4600
4429
|
observer.onError.bind(observer),
|
4601
4430
|
function () {
|
4602
4431
|
isStopped = true;
|
4603
|
-
if (!hasCurrent && g.length === 1) {
|
4432
|
+
if (!hasCurrent && g.length === 1) {
|
4604
4433
|
observer.onCompleted();
|
4605
4434
|
}
|
4606
4435
|
}));
|
@@ -4608,6 +4437,7 @@
|
|
4608
4437
|
return g;
|
4609
4438
|
});
|
4610
4439
|
};
|
4440
|
+
|
4611
4441
|
/*
|
4612
4442
|
* Performs a exclusive map waiting for the first to finish before subscribing to another observable.
|
4613
4443
|
* Observables that come in between subscriptions will be dropped on the floor.
|
@@ -4630,12 +4460,12 @@
|
|
4630
4460
|
function (innerSource) {
|
4631
4461
|
|
4632
4462
|
if (!hasCurrent) {
|
4633
|
-
hasCurrent = true;
|
4463
|
+
hasCurrent = true;
|
4634
4464
|
|
4635
4465
|
innerSubscription = new SingleAssignmentDisposable();
|
4636
4466
|
g.add(innerSubscription);
|
4637
4467
|
|
4638
|
-
isPromise(innerSource) && (innerSource = observableFromPromise(innerSource));
|
4468
|
+
isPromise(innerSource) && (innerSource = observableFromPromise(innerSource));
|
4639
4469
|
|
4640
4470
|
innerSubscription.setDisposable(innerSource.subscribe(
|
4641
4471
|
function (x) {
|
@@ -4659,7 +4489,7 @@
|
|
4659
4489
|
}
|
4660
4490
|
}));
|
4661
4491
|
}
|
4662
|
-
},
|
4492
|
+
},
|
4663
4493
|
observer.onError.bind(observer),
|
4664
4494
|
function () {
|
4665
4495
|
isStopped = true;
|
@@ -4670,6 +4500,7 @@
|
|
4670
4500
|
return g;
|
4671
4501
|
});
|
4672
4502
|
};
|
4503
|
+
|
4673
4504
|
var AnonymousObservable = Rx.AnonymousObservable = (function (__super__) {
|
4674
4505
|
inherits(AnonymousObservable, __super__);
|
4675
4506
|
|
@@ -4694,7 +4525,7 @@
|
|
4694
4525
|
} catch (e) {
|
4695
4526
|
if (!autoDetachObserver.fail(e)) {
|
4696
4527
|
throw e;
|
4697
|
-
}
|
4528
|
+
}
|
4698
4529
|
}
|
4699
4530
|
};
|
4700
4531
|
|
@@ -4732,8 +4563,8 @@
|
|
4732
4563
|
try {
|
4733
4564
|
this.observer.onNext(value);
|
4734
4565
|
noError = true;
|
4735
|
-
} catch (e) {
|
4736
|
-
throw e;
|
4566
|
+
} catch (e) {
|
4567
|
+
throw e;
|
4737
4568
|
} finally {
|
4738
4569
|
if (!noError) {
|
4739
4570
|
this.dispose();
|
@@ -4744,8 +4575,8 @@
|
|
4744
4575
|
AutoDetachObserverPrototype.error = function (exn) {
|
4745
4576
|
try {
|
4746
4577
|
this.observer.onError(exn);
|
4747
|
-
} catch (e) {
|
4748
|
-
throw e;
|
4578
|
+
} catch (e) {
|
4579
|
+
throw e;
|
4749
4580
|
} finally {
|
4750
4581
|
this.dispose();
|
4751
4582
|
}
|
@@ -4754,8 +4585,8 @@
|
|
4754
4585
|
AutoDetachObserverPrototype.completed = function () {
|
4755
4586
|
try {
|
4756
4587
|
this.observer.onCompleted();
|
4757
|
-
} catch (e) {
|
4758
|
-
throw e;
|
4588
|
+
} catch (e) {
|
4589
|
+
throw e;
|
4759
4590
|
} finally {
|
4760
4591
|
this.dispose();
|
4761
4592
|
}
|
@@ -4776,23 +4607,23 @@
|
|
4776
4607
|
return AutoDetachObserver;
|
4777
4608
|
}(AbstractObserver));
|
4778
4609
|
|
4779
|
-
/** @private */
|
4780
|
-
var InnerSubscription = function (subject, observer) {
|
4781
|
-
this.subject = subject;
|
4782
|
-
this.observer = observer;
|
4783
|
-
};
|
4784
|
-
|
4785
|
-
/**
|
4786
|
-
* @private
|
4787
|
-
* @memberOf InnerSubscription
|
4788
|
-
*/
|
4789
|
-
InnerSubscription.prototype.dispose = function () {
|
4790
|
-
if (!this.subject.isDisposed && this.observer !== null) {
|
4791
|
-
var idx = this.subject.observers.indexOf(this.observer);
|
4792
|
-
this.subject.observers.splice(idx, 1);
|
4793
|
-
this.observer = null;
|
4794
|
-
}
|
4795
|
-
};
|
4610
|
+
/** @private */
|
4611
|
+
var InnerSubscription = function (subject, observer) {
|
4612
|
+
this.subject = subject;
|
4613
|
+
this.observer = observer;
|
4614
|
+
};
|
4615
|
+
|
4616
|
+
/**
|
4617
|
+
* @private
|
4618
|
+
* @memberOf InnerSubscription
|
4619
|
+
*/
|
4620
|
+
InnerSubscription.prototype.dispose = function () {
|
4621
|
+
if (!this.subject.isDisposed && this.observer !== null) {
|
4622
|
+
var idx = this.subject.observers.indexOf(this.observer);
|
4623
|
+
this.subject.observers.splice(idx, 1);
|
4624
|
+
this.observer = null;
|
4625
|
+
}
|
4626
|
+
};
|
4796
4627
|
|
4797
4628
|
/**
|
4798
4629
|
* Represents an object that is both an observable sequence as well as an observer.
|
@@ -4818,7 +4649,7 @@
|
|
4818
4649
|
/**
|
4819
4650
|
* Creates a subject.
|
4820
4651
|
* @constructor
|
4821
|
-
*/
|
4652
|
+
*/
|
4822
4653
|
function Subject() {
|
4823
4654
|
_super.call(this, subscribe);
|
4824
4655
|
this.isDisposed = false,
|
@@ -4830,13 +4661,13 @@
|
|
4830
4661
|
/**
|
4831
4662
|
* Indicates whether the subject has observers subscribed to it.
|
4832
4663
|
* @returns {Boolean} Indicates whether the subject has observers subscribed to it.
|
4833
|
-
*/
|
4664
|
+
*/
|
4834
4665
|
hasObservers: function () {
|
4835
4666
|
return this.observers.length > 0;
|
4836
4667
|
},
|
4837
4668
|
/**
|
4838
4669
|
* Notifies all subscribed observers about the end of the sequence.
|
4839
|
-
*/
|
4670
|
+
*/
|
4840
4671
|
onCompleted: function () {
|
4841
4672
|
checkDisposed.call(this);
|
4842
4673
|
if (!this.isStopped) {
|
@@ -4852,7 +4683,7 @@
|
|
4852
4683
|
/**
|
4853
4684
|
* Notifies all subscribed observers about the exception.
|
4854
4685
|
* @param {Mixed} error The exception to send to all observers.
|
4855
|
-
*/
|
4686
|
+
*/
|
4856
4687
|
onError: function (exception) {
|
4857
4688
|
checkDisposed.call(this);
|
4858
4689
|
if (!this.isStopped) {
|
@@ -4869,7 +4700,7 @@
|
|
4869
4700
|
/**
|
4870
4701
|
* Notifies all subscribed observers about the arrival of the specified element in the sequence.
|
4871
4702
|
* @param {Mixed} value The value to send to all observers.
|
4872
|
-
*/
|
4703
|
+
*/
|
4873
4704
|
onNext: function (value) {
|
4874
4705
|
checkDisposed.call(this);
|
4875
4706
|
if (!this.isStopped) {
|
@@ -4881,7 +4712,7 @@
|
|
4881
4712
|
},
|
4882
4713
|
/**
|
4883
4714
|
* Unsubscribe all observers and release resources.
|
4884
|
-
*/
|
4715
|
+
*/
|
4885
4716
|
dispose: function () {
|
4886
4717
|
this.isDisposed = true;
|
4887
4718
|
this.observers = null;
|
@@ -4904,12 +4735,12 @@
|
|
4904
4735
|
/**
|
4905
4736
|
* Represents the result of an asynchronous operation.
|
4906
4737
|
* The last value before the OnCompleted notification, or the error received through OnError, is sent to all subscribed observers.
|
4907
|
-
*/
|
4738
|
+
*/
|
4908
4739
|
var AsyncSubject = Rx.AsyncSubject = (function (__super__) {
|
4909
4740
|
|
4910
4741
|
function subscribe(observer) {
|
4911
4742
|
checkDisposed.call(this);
|
4912
|
-
|
4743
|
+
|
4913
4744
|
if (!this.isStopped) {
|
4914
4745
|
this.observers.push(observer);
|
4915
4746
|
return new InnerSubscription(this, observer);
|
@@ -4936,7 +4767,7 @@
|
|
4936
4767
|
/**
|
4937
4768
|
* Creates a subject that can only receive one value and that value is cached for all future observations.
|
4938
4769
|
* @constructor
|
4939
|
-
*/
|
4770
|
+
*/
|
4940
4771
|
function AsyncSubject() {
|
4941
4772
|
__super__.call(this, subscribe);
|
4942
4773
|
|
@@ -4952,14 +4783,14 @@
|
|
4952
4783
|
/**
|
4953
4784
|
* Indicates whether the subject has observers subscribed to it.
|
4954
4785
|
* @returns {Boolean} Indicates whether the subject has observers subscribed to it.
|
4955
|
-
*/
|
4786
|
+
*/
|
4956
4787
|
hasObservers: function () {
|
4957
4788
|
checkDisposed.call(this);
|
4958
4789
|
return this.observers.length > 0;
|
4959
4790
|
},
|
4960
4791
|
/**
|
4961
4792
|
* Notifies all subscribed observers about the end of the sequence, also causing the last received value to be sent out (if any).
|
4962
|
-
*/
|
4793
|
+
*/
|
4963
4794
|
onCompleted: function () {
|
4964
4795
|
var o, i, len;
|
4965
4796
|
checkDisposed.call(this);
|
@@ -4987,7 +4818,7 @@
|
|
4987
4818
|
/**
|
4988
4819
|
* Notifies all subscribed observers about the error.
|
4989
4820
|
* @param {Mixed} error The Error to send to all observers.
|
4990
|
-
*/
|
4821
|
+
*/
|
4991
4822
|
onError: function (error) {
|
4992
4823
|
checkDisposed.call(this);
|
4993
4824
|
if (!this.isStopped) {
|
@@ -5005,7 +4836,7 @@
|
|
5005
4836
|
/**
|
5006
4837
|
* Sends a value to the subject. The last value received before successful termination will be sent to all subscribed and future observers.
|
5007
4838
|
* @param {Mixed} value The value to store in the subject.
|
5008
|
-
*/
|
4839
|
+
*/
|
5009
4840
|
onNext: function (value) {
|
5010
4841
|
checkDisposed.call(this);
|
5011
4842
|
if (this.isStopped) { return; }
|
@@ -5026,29 +4857,29 @@
|
|
5026
4857
|
return AsyncSubject;
|
5027
4858
|
}(Observable));
|
5028
4859
|
|
5029
|
-
var AnonymousSubject = Rx.AnonymousSubject = (function (__super__) {
|
5030
|
-
inherits(AnonymousSubject, __super__);
|
5031
|
-
|
5032
|
-
function AnonymousSubject(observer, observable) {
|
5033
|
-
this.observer = observer;
|
5034
|
-
this.observable = observable;
|
5035
|
-
__super__.call(this, this.observable.subscribe.bind(this.observable));
|
5036
|
-
}
|
5037
|
-
|
5038
|
-
addProperties(AnonymousSubject.prototype, Observer, {
|
5039
|
-
onCompleted: function () {
|
5040
|
-
this.observer.onCompleted();
|
5041
|
-
},
|
5042
|
-
onError: function (exception) {
|
5043
|
-
this.observer.onError(exception);
|
5044
|
-
},
|
5045
|
-
onNext: function (value) {
|
5046
|
-
this.observer.onNext(value);
|
5047
|
-
}
|
5048
|
-
});
|
5049
|
-
|
5050
|
-
return AnonymousSubject;
|
5051
|
-
}(Observable));
|
4860
|
+
var AnonymousSubject = Rx.AnonymousSubject = (function (__super__) {
|
4861
|
+
inherits(AnonymousSubject, __super__);
|
4862
|
+
|
4863
|
+
function AnonymousSubject(observer, observable) {
|
4864
|
+
this.observer = observer;
|
4865
|
+
this.observable = observable;
|
4866
|
+
__super__.call(this, this.observable.subscribe.bind(this.observable));
|
4867
|
+
}
|
4868
|
+
|
4869
|
+
addProperties(AnonymousSubject.prototype, Observer, {
|
4870
|
+
onCompleted: function () {
|
4871
|
+
this.observer.onCompleted();
|
4872
|
+
},
|
4873
|
+
onError: function (exception) {
|
4874
|
+
this.observer.onError(exception);
|
4875
|
+
},
|
4876
|
+
onNext: function (value) {
|
4877
|
+
this.observer.onNext(value);
|
4878
|
+
}
|
4879
|
+
});
|
4880
|
+
|
4881
|
+
return AnonymousSubject;
|
4882
|
+
}(Observable));
|
5052
4883
|
|
5053
4884
|
/**
|
5054
4885
|
* Represents a value that changes over time.
|
@@ -5077,7 +4908,7 @@
|
|
5077
4908
|
* @constructor
|
5078
4909
|
* Initializes a new instance of the BehaviorSubject class which creates a subject that caches its last value and starts with the specified value.
|
5079
4910
|
* @param {Mixed} value Initial value sent to observers when no other value has been received by the subject yet.
|
5080
|
-
*/
|
4911
|
+
*/
|
5081
4912
|
function BehaviorSubject(value) {
|
5082
4913
|
__super__.call(this, subscribe);
|
5083
4914
|
this.value = value,
|
@@ -5091,13 +4922,13 @@
|
|
5091
4922
|
/**
|
5092
4923
|
* Indicates whether the subject has observers subscribed to it.
|
5093
4924
|
* @returns {Boolean} Indicates whether the subject has observers subscribed to it.
|
5094
|
-
*/
|
4925
|
+
*/
|
5095
4926
|
hasObservers: function () {
|
5096
4927
|
return this.observers.length > 0;
|
5097
4928
|
},
|
5098
4929
|
/**
|
5099
4930
|
* Notifies all subscribed observers about the end of the sequence.
|
5100
|
-
*/
|
4931
|
+
*/
|
5101
4932
|
onCompleted: function () {
|
5102
4933
|
checkDisposed.call(this);
|
5103
4934
|
if (this.isStopped) { return; }
|
@@ -5111,7 +4942,7 @@
|
|
5111
4942
|
/**
|
5112
4943
|
* Notifies all subscribed observers about the exception.
|
5113
4944
|
* @param {Mixed} error The exception to send to all observers.
|
5114
|
-
*/
|
4945
|
+
*/
|
5115
4946
|
onError: function (error) {
|
5116
4947
|
checkDisposed.call(this);
|
5117
4948
|
if (this.isStopped) { return; }
|
@@ -5127,7 +4958,7 @@
|
|
5127
4958
|
/**
|
5128
4959
|
* Notifies all subscribed observers about the arrival of the specified element in the sequence.
|
5129
4960
|
* @param {Mixed} value The value to send to all observers.
|
5130
|
-
*/
|
4961
|
+
*/
|
5131
4962
|
onNext: function (value) {
|
5132
4963
|
checkDisposed.call(this);
|
5133
4964
|
if (this.isStopped) { return; }
|
@@ -5138,7 +4969,7 @@
|
|
5138
4969
|
},
|
5139
4970
|
/**
|
5140
4971
|
* Unsubscribe all observers and release resources.
|
5141
|
-
*/
|
4972
|
+
*/
|
5142
4973
|
dispose: function () {
|
5143
4974
|
this.isDisposed = true;
|
5144
4975
|
this.observers = null;
|
@@ -5153,7 +4984,7 @@
|
|
5153
4984
|
/**
|
5154
4985
|
* Represents an object that is both an observable sequence as well as an observer.
|
5155
4986
|
* Each notification is broadcasted to all subscribed and future observers, subject to buffer trimming policies.
|
5156
|
-
*/
|
4987
|
+
*/
|
5157
4988
|
var ReplaySubject = Rx.ReplaySubject = (function (__super__) {
|
5158
4989
|
|
5159
4990
|
function createRemovableDisposable(subject, observer) {
|
@@ -5213,7 +5044,7 @@
|
|
5213
5044
|
/**
|
5214
5045
|
* Indicates whether the subject has observers subscribed to it.
|
5215
5046
|
* @returns {Boolean} Indicates whether the subject has observers subscribed to it.
|
5216
|
-
*/
|
5047
|
+
*/
|
5217
5048
|
hasObservers: function () {
|
5218
5049
|
return this.observers.length > 0;
|
5219
5050
|
},
|
@@ -5228,7 +5059,7 @@
|
|
5228
5059
|
/**
|
5229
5060
|
* Notifies all subscribed observers about the arrival of the specified element in the sequence.
|
5230
5061
|
* @param {Mixed} value The value to send to all observers.
|
5231
|
-
*/
|
5062
|
+
*/
|
5232
5063
|
onNext: function (value) {
|
5233
5064
|
checkDisposed.call(this);
|
5234
5065
|
if (this.isStopped) { return; }
|
@@ -5246,7 +5077,7 @@
|
|
5246
5077
|
/**
|
5247
5078
|
* Notifies all subscribed observers about the exception.
|
5248
5079
|
* @param {Mixed} error The exception to send to all observers.
|
5249
|
-
*/
|
5080
|
+
*/
|
5250
5081
|
onError: function (error) {
|
5251
5082
|
checkDisposed.call(this);
|
5252
5083
|
if (this.isStopped) { return; }
|
@@ -5265,7 +5096,7 @@
|
|
5265
5096
|
},
|
5266
5097
|
/**
|
5267
5098
|
* Notifies all subscribed observers about the end of the sequence.
|
5268
|
-
*/
|
5099
|
+
*/
|
5269
5100
|
onCompleted: function () {
|
5270
5101
|
checkDisposed.call(this);
|
5271
5102
|
if (this.isStopped) { return; }
|
@@ -5282,7 +5113,7 @@
|
|
5282
5113
|
},
|
5283
5114
|
/**
|
5284
5115
|
* Unsubscribe all observers and release resources.
|
5285
|
-
*/
|
5116
|
+
*/
|
5286
5117
|
dispose: function () {
|
5287
5118
|
this.isDisposed = true;
|
5288
5119
|
this.observers = null;
|
@@ -5292,21 +5123,22 @@
|
|
5292
5123
|
return ReplaySubject;
|
5293
5124
|
}(Observable));
|
5294
5125
|
|
5295
|
-
if (typeof define == 'function' && typeof define.amd == 'object' && define.amd) {
|
5296
|
-
root.Rx = Rx;
|
5297
|
-
|
5298
|
-
define(function() {
|
5299
|
-
return Rx;
|
5300
|
-
});
|
5301
|
-
} else if (freeExports && freeModule) {
|
5302
|
-
// in Node.js or RingoJS
|
5303
|
-
if (moduleExports) {
|
5304
|
-
(freeModule.exports = Rx).Rx = Rx;
|
5305
|
-
} else {
|
5306
|
-
freeExports.Rx = Rx;
|
5307
|
-
}
|
5308
|
-
} else {
|
5309
|
-
// in a browser or Rhino
|
5310
|
-
root.Rx = Rx;
|
5126
|
+
if (typeof define == 'function' && typeof define.amd == 'object' && define.amd) {
|
5127
|
+
root.Rx = Rx;
|
5128
|
+
|
5129
|
+
define(function() {
|
5130
|
+
return Rx;
|
5131
|
+
});
|
5132
|
+
} else if (freeExports && freeModule) {
|
5133
|
+
// in Node.js or RingoJS
|
5134
|
+
if (moduleExports) {
|
5135
|
+
(freeModule.exports = Rx).Rx = Rx;
|
5136
|
+
} else {
|
5137
|
+
freeExports.Rx = Rx;
|
5138
|
+
}
|
5139
|
+
} else {
|
5140
|
+
// in a browser or Rhino
|
5141
|
+
root.Rx = Rx;
|
5311
5142
|
}
|
5312
|
-
|
5143
|
+
|
5144
|
+
}.call(this));
|