rxjs-rails 2.3.0 → 2.3.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/rxjs/rails/version.rb +1 -1
- data/vendor/assets/javascripts/rx.aggregates.js +115 -27
- data/vendor/assets/javascripts/rx.aggregates.min.js +1 -1
- data/vendor/assets/javascripts/rx.all.compat.js +2751 -2702
- data/vendor/assets/javascripts/rx.all.compat.min.js +3 -3
- data/vendor/assets/javascripts/rx.all.js +2605 -2589
- data/vendor/assets/javascripts/rx.all.min.js +3 -3
- data/vendor/assets/javascripts/rx.async.compat.js +41 -22
- data/vendor/assets/javascripts/rx.async.compat.min.js +1 -1
- data/vendor/assets/javascripts/rx.async.js +41 -22
- data/vendor/assets/javascripts/rx.async.min.js +1 -1
- data/vendor/assets/javascripts/rx.backpressure.js +41 -45
- data/vendor/assets/javascripts/rx.backpressure.min.js +1 -1
- data/vendor/assets/javascripts/rx.binding.js +81 -111
- data/vendor/assets/javascripts/rx.binding.min.js +1 -1
- data/vendor/assets/javascripts/rx.coincidence.js +567 -486
- data/vendor/assets/javascripts/rx.coincidence.min.js +1 -1
- data/vendor/assets/javascripts/rx.compat.js +1430 -1532
- data/vendor/assets/javascripts/rx.compat.min.js +2 -2
- data/vendor/assets/javascripts/rx.core.compat.js +76 -127
- data/vendor/assets/javascripts/rx.core.compat.min.js +1 -1
- data/vendor/assets/javascripts/rx.core.js +76 -127
- data/vendor/assets/javascripts/rx.core.min.js +1 -1
- data/vendor/assets/javascripts/rx.experimental.js +36 -36
- data/vendor/assets/javascripts/rx.experimental.min.js +1 -1
- data/vendor/assets/javascripts/rx.joinpatterns.js +281 -281
- data/vendor/assets/javascripts/rx.js +1286 -1421
- data/vendor/assets/javascripts/rx.lite.compat.js +1443 -1749
- data/vendor/assets/javascripts/rx.lite.compat.min.js +2 -2
- data/vendor/assets/javascripts/rx.lite.extras.js +133 -205
- data/vendor/assets/javascripts/rx.lite.extras.min.js +1 -1
- data/vendor/assets/javascripts/rx.lite.js +1319 -1658
- data/vendor/assets/javascripts/rx.lite.min.js +2 -2
- data/vendor/assets/javascripts/rx.min.js +2 -2
- data/vendor/assets/javascripts/rx.testing.js +302 -322
- data/vendor/assets/javascripts/rx.testing.min.js +1 -1
- data/vendor/assets/javascripts/rx.time.js +90 -75
- data/vendor/assets/javascripts/rx.time.min.js +1 -1
- data/vendor/assets/javascripts/rx.virtualtime.js +264 -279
- data/vendor/assets/javascripts/rx.virtualtime.min.js +1 -1
- metadata +10 -11
@@ -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 (factory) {
|
4
4
|
var objectTypes = {
|
@@ -55,6 +55,7 @@
|
|
55
55
|
isPromise = helpers.isPromise,
|
56
56
|
inherits = internals.inherits,
|
57
57
|
noop = helpers.noop,
|
58
|
+
isScheduler = helpers.isScheduler,
|
58
59
|
observableFromPromise = Observable.fromPromise,
|
59
60
|
slice = Array.prototype.slice;
|
60
61
|
|
@@ -66,21 +67,21 @@
|
|
66
67
|
|
67
68
|
var argumentOutOfRange = 'Argument out of range';
|
68
69
|
|
69
|
-
function ScheduledDisposable(scheduler, disposable) {
|
70
|
-
this.scheduler = scheduler;
|
71
|
-
this.disposable = disposable;
|
72
|
-
this.isDisposed = false;
|
73
|
-
}
|
74
|
-
|
75
|
-
ScheduledDisposable.prototype.dispose = function () {
|
76
|
-
var parent = this;
|
77
|
-
this.scheduler.schedule(function () {
|
78
|
-
if (!parent.isDisposed) {
|
79
|
-
parent.isDisposed = true;
|
80
|
-
parent.disposable.dispose();
|
81
|
-
}
|
82
|
-
});
|
83
|
-
};
|
70
|
+
function ScheduledDisposable(scheduler, disposable) {
|
71
|
+
this.scheduler = scheduler;
|
72
|
+
this.disposable = disposable;
|
73
|
+
this.isDisposed = false;
|
74
|
+
}
|
75
|
+
|
76
|
+
ScheduledDisposable.prototype.dispose = function () {
|
77
|
+
var parent = this;
|
78
|
+
this.scheduler.schedule(function () {
|
79
|
+
if (!parent.isDisposed) {
|
80
|
+
parent.isDisposed = true;
|
81
|
+
parent.disposable.dispose();
|
82
|
+
}
|
83
|
+
});
|
84
|
+
};
|
84
85
|
|
85
86
|
var CheckedObserver = (function (_super) {
|
86
87
|
inherits(CheckedObserver, _super);
|
@@ -203,6 +204,49 @@
|
|
203
204
|
});
|
204
205
|
};
|
205
206
|
|
207
|
+
/**
|
208
|
+
* Generates an observable sequence by running a state-driven loop producing the sequence's elements, using the specified scheduler to send out observer messages.
|
209
|
+
*
|
210
|
+
* @example
|
211
|
+
* var res = Rx.Observable.generate(0, function (x) { return x < 10; }, function (x) { return x + 1; }, function (x) { return x; });
|
212
|
+
* var res = Rx.Observable.generate(0, function (x) { return x < 10; }, function (x) { return x + 1; }, function (x) { return x; }, Rx.Scheduler.timeout);
|
213
|
+
* @param {Mixed} initialState Initial state.
|
214
|
+
* @param {Function} condition Condition to terminate generation (upon returning false).
|
215
|
+
* @param {Function} iterate Iteration step function.
|
216
|
+
* @param {Function} resultSelector Selector function for results produced in the sequence.
|
217
|
+
* @param {Scheduler} [scheduler] Scheduler on which to run the generator loop. If not provided, defaults to Scheduler.currentThread.
|
218
|
+
* @returns {Observable} The generated sequence.
|
219
|
+
*/
|
220
|
+
Observable.generate = function (initialState, condition, iterate, resultSelector, scheduler) {
|
221
|
+
isScheduler(scheduler) || (scheduler = currentThreadScheduler);
|
222
|
+
return new AnonymousObservable(function (observer) {
|
223
|
+
var first = true, state = initialState;
|
224
|
+
return scheduler.scheduleRecursive(function (self) {
|
225
|
+
var hasResult, result;
|
226
|
+
try {
|
227
|
+
if (first) {
|
228
|
+
first = false;
|
229
|
+
} else {
|
230
|
+
state = iterate(state);
|
231
|
+
}
|
232
|
+
hasResult = condition(state);
|
233
|
+
if (hasResult) {
|
234
|
+
result = resultSelector(state);
|
235
|
+
}
|
236
|
+
} catch (exception) {
|
237
|
+
observer.onError(exception);
|
238
|
+
return;
|
239
|
+
}
|
240
|
+
if (hasResult) {
|
241
|
+
observer.onNext(result);
|
242
|
+
self();
|
243
|
+
} else {
|
244
|
+
observer.onCompleted();
|
245
|
+
}
|
246
|
+
});
|
247
|
+
});
|
248
|
+
};
|
249
|
+
|
206
250
|
/**
|
207
251
|
* Constructs an observable sequence that depends on a resource object, whose lifetime is tied to the resulting observable sequence's lifetime.
|
208
252
|
*
|
@@ -439,6 +483,29 @@
|
|
439
483
|
});
|
440
484
|
};
|
441
485
|
|
486
|
+
/**
|
487
|
+
* Returns an array with the specified number of contiguous elements from the end of an observable sequence.
|
488
|
+
*
|
489
|
+
* @description
|
490
|
+
* This operator accumulates a buffer with a length enough to store count elements. Upon completion of the
|
491
|
+
* source sequence, this buffer is produced on the result sequence.
|
492
|
+
* @param {Number} count Number of elements to take from the end of the source sequence.
|
493
|
+
* @returns {Observable} An observable sequence containing a single array with the specified number of elements from the end of the source sequence.
|
494
|
+
*/
|
495
|
+
observableProto.takeLastBuffer = function (count) {
|
496
|
+
var source = this;
|
497
|
+
return new AnonymousObservable(function (observer) {
|
498
|
+
var q = [];
|
499
|
+
return source.subscribe(function (x) {
|
500
|
+
q.push(x);
|
501
|
+
q.length > count && q.shift();
|
502
|
+
}, observer.onError.bind(observer), function () {
|
503
|
+
observer.onNext(q);
|
504
|
+
observer.onCompleted();
|
505
|
+
});
|
506
|
+
});
|
507
|
+
};
|
508
|
+
|
442
509
|
/**
|
443
510
|
* Returns the elements of the specified sequence or the specified value in a singleton sequence if the sequence is empty.
|
444
511
|
*
|
@@ -468,197 +535,58 @@
|
|
468
535
|
});
|
469
536
|
};
|
470
537
|
|
471
|
-
|
472
|
-
|
473
|
-
|
474
|
-
|
475
|
-
|
476
|
-
|
477
|
-
|
478
|
-
* 2 - obs = xs.distinct(function (x) { return x.id; }, function (x) { return x.toString(); });
|
479
|
-
* @param {Function} [keySelector] A function to compute the comparison key for each element.
|
480
|
-
* @param {Function} [keySerializer] Used to serialize the given object into a string for object comparison.
|
481
|
-
* @returns {Observable} An observable sequence only containing the distinct elements, based on a computed key value, from the source sequence.
|
482
|
-
*/
|
483
|
-
observableProto.distinct = function (keySelector, keySerializer) {
|
484
|
-
var source = this;
|
485
|
-
keySelector || (keySelector = identity);
|
486
|
-
keySerializer || (keySerializer = defaultKeySerializer);
|
487
|
-
return new AnonymousObservable(function (observer) {
|
488
|
-
var hashSet = {};
|
489
|
-
return source.subscribe(function (x) {
|
490
|
-
var key, serializedKey, otherKey, hasMatch = false;
|
491
|
-
try {
|
492
|
-
key = keySelector(x);
|
493
|
-
serializedKey = keySerializer(key);
|
494
|
-
} catch (exception) {
|
495
|
-
observer.onError(exception);
|
496
|
-
return;
|
497
|
-
}
|
498
|
-
for (otherKey in hashSet) {
|
499
|
-
if (serializedKey === otherKey) {
|
500
|
-
hasMatch = true;
|
501
|
-
break;
|
502
|
-
}
|
503
|
-
}
|
504
|
-
if (!hasMatch) {
|
505
|
-
hashSet[serializedKey] = null;
|
506
|
-
observer.onNext(x);
|
507
|
-
}
|
508
|
-
}, observer.onError.bind(observer), observer.onCompleted.bind(observer));
|
509
|
-
});
|
510
|
-
};
|
511
|
-
|
512
|
-
/**
|
513
|
-
* Groups the elements of an observable sequence according to a specified key selector function and comparer and selects the resulting elements by using a specified function.
|
514
|
-
*
|
515
|
-
* @example
|
516
|
-
* var res = observable.groupBy(function (x) { return x.id; });
|
517
|
-
* 2 - observable.groupBy(function (x) { return x.id; }), function (x) { return x.name; });
|
518
|
-
* 3 - observable.groupBy(function (x) { return x.id; }), function (x) { return x.name; }, function (x) { return x.toString(); });
|
519
|
-
* @param {Function} keySelector A function to extract the key for each element.
|
520
|
-
* @param {Function} [elementSelector] A function to map each source element to an element in an observable group.
|
521
|
-
* @param {Function} [keySerializer] Used to serialize the given object into a string for object comparison.
|
522
|
-
* @returns {Observable} A sequence of observable groups, each of which corresponds to a unique key value, containing all elements that share that same key value.
|
523
|
-
*/
|
524
|
-
observableProto.groupBy = function (keySelector, elementSelector, keySerializer) {
|
525
|
-
return this.groupByUntil(keySelector, elementSelector, function () {
|
526
|
-
return observableNever();
|
527
|
-
}, keySerializer);
|
528
|
-
};
|
529
|
-
|
530
|
-
/**
|
531
|
-
* Groups the elements of an observable sequence according to a specified key selector function.
|
532
|
-
* A duration selector function is used to control the lifetime of groups. When a group expires, it receives an OnCompleted notification. When a new element with the same
|
533
|
-
* key value as a reclaimed group occurs, the group will be reborn with a new lifetime request.
|
534
|
-
*
|
535
|
-
* @example
|
536
|
-
* var res = observable.groupByUntil(function (x) { return x.id; }, null, function () { return Rx.Observable.never(); });
|
537
|
-
* 2 - observable.groupBy(function (x) { return x.id; }), function (x) { return x.name; }, function () { return Rx.Observable.never(); });
|
538
|
-
* 3 - observable.groupBy(function (x) { return x.id; }), function (x) { return x.name; }, function () { return Rx.Observable.never(); }, function (x) { return x.toString(); });
|
539
|
-
* @param {Function} keySelector A function to extract the key for each element.
|
540
|
-
* @param {Function} durationSelector A function to signal the expiration of a group.
|
541
|
-
* @param {Function} [keySerializer] Used to serialize the given object into a string for object comparison.
|
542
|
-
* @returns {Observable}
|
543
|
-
* A sequence of observable groups, each of which corresponds to a unique key value, containing all elements that share that same key value.
|
544
|
-
* If a group's lifetime expires, a new group with the same key value can be created once an element with such a key value is encoutered.
|
545
|
-
*
|
546
|
-
*/
|
547
|
-
observableProto.groupByUntil = function (keySelector, elementSelector, durationSelector, keySerializer) {
|
548
|
-
var source = this;
|
549
|
-
elementSelector || (elementSelector = identity);
|
550
|
-
keySerializer || (keySerializer = defaultKeySerializer);
|
551
|
-
return new AnonymousObservable(function (observer) {
|
552
|
-
var map = {},
|
553
|
-
groupDisposable = new CompositeDisposable(),
|
554
|
-
refCountDisposable = new RefCountDisposable(groupDisposable);
|
555
|
-
groupDisposable.add(source.subscribe(function (x) {
|
556
|
-
var duration, durationGroup, element, fireNewMapEntry, group, key, serializedKey, md, writer, w;
|
557
|
-
try {
|
558
|
-
key = keySelector(x);
|
559
|
-
serializedKey = keySerializer(key);
|
560
|
-
} catch (e) {
|
561
|
-
for (w in map) {
|
562
|
-
map[w].onError(e);
|
563
|
-
}
|
564
|
-
observer.onError(e);
|
565
|
-
return;
|
566
|
-
}
|
567
|
-
fireNewMapEntry = false;
|
568
|
-
try {
|
569
|
-
writer = map[serializedKey];
|
570
|
-
if (!writer) {
|
571
|
-
writer = new Subject();
|
572
|
-
map[serializedKey] = writer;
|
573
|
-
fireNewMapEntry = true;
|
574
|
-
}
|
575
|
-
} catch (e) {
|
576
|
-
for (w in map) {
|
577
|
-
map[w].onError(e);
|
578
|
-
}
|
579
|
-
observer.onError(e);
|
580
|
-
return;
|
581
|
-
}
|
582
|
-
if (fireNewMapEntry) {
|
583
|
-
group = new GroupedObservable(key, writer, refCountDisposable);
|
584
|
-
durationGroup = new GroupedObservable(key, writer);
|
585
|
-
try {
|
586
|
-
duration = durationSelector(durationGroup);
|
587
|
-
} catch (e) {
|
588
|
-
for (w in map) {
|
589
|
-
map[w].onError(e);
|
590
|
-
}
|
591
|
-
observer.onError(e);
|
592
|
-
return;
|
593
|
-
}
|
594
|
-
observer.onNext(group);
|
595
|
-
md = new SingleAssignmentDisposable();
|
596
|
-
groupDisposable.add(md);
|
597
|
-
var expire = function () {
|
598
|
-
if (serializedKey in map) {
|
599
|
-
delete map[serializedKey];
|
600
|
-
writer.onCompleted();
|
601
|
-
}
|
602
|
-
groupDisposable.remove(md);
|
603
|
-
};
|
604
|
-
md.setDisposable(duration.take(1).subscribe(noop, function (exn) {
|
605
|
-
for (w in map) {
|
606
|
-
map[w].onError(exn);
|
607
|
-
}
|
608
|
-
observer.onError(exn);
|
609
|
-
}, function () {
|
610
|
-
expire();
|
611
|
-
}));
|
612
|
-
}
|
613
|
-
try {
|
614
|
-
element = elementSelector(x);
|
615
|
-
} catch (e) {
|
616
|
-
for (w in map) {
|
617
|
-
map[w].onError(e);
|
618
|
-
}
|
619
|
-
observer.onError(e);
|
620
|
-
return;
|
621
|
-
}
|
622
|
-
writer.onNext(element);
|
623
|
-
}, function (ex) {
|
624
|
-
for (var w in map) {
|
625
|
-
map[w].onError(ex);
|
626
|
-
}
|
627
|
-
observer.onError(ex);
|
628
|
-
}, function () {
|
629
|
-
for (var w in map) {
|
630
|
-
map[w].onCompleted();
|
631
|
-
}
|
632
|
-
observer.onCompleted();
|
633
|
-
}));
|
634
|
-
return refCountDisposable;
|
635
|
-
});
|
636
|
-
};
|
637
|
-
|
638
|
-
/** @private */
|
639
|
-
var GroupedObservable = (function (_super) {
|
640
|
-
inherits(GroupedObservable, _super);
|
538
|
+
// Swap out for Array.findIndex
|
539
|
+
function arrayIndexOfComparer(array, item, comparer) {
|
540
|
+
for (var i = 0, len = array.length; i < len; i++) {
|
541
|
+
if (comparer(array[i], item)) { return i; }
|
542
|
+
}
|
543
|
+
return -1;
|
544
|
+
}
|
641
545
|
|
642
|
-
|
643
|
-
|
644
|
-
|
546
|
+
function HashSet(comparer) {
|
547
|
+
this.comparer = comparer;
|
548
|
+
this.set = [];
|
549
|
+
}
|
550
|
+
HashSet.prototype.push = function(value) {
|
551
|
+
var retValue = arrayIndexOfComparer(this.set, value, this.comparer) === -1;
|
552
|
+
retValue && this.set.push(value);
|
553
|
+
return retValue;
|
554
|
+
};
|
645
555
|
|
646
|
-
|
647
|
-
|
648
|
-
|
649
|
-
|
650
|
-
|
651
|
-
|
652
|
-
|
653
|
-
|
654
|
-
|
655
|
-
|
656
|
-
|
657
|
-
|
556
|
+
/**
|
557
|
+
* Returns an observable sequence that contains only distinct elements according to the keySelector and the comparer.
|
558
|
+
* Usage of this operator should be considered carefully due to the maintenance of an internal lookup structure which can grow large.
|
559
|
+
*
|
560
|
+
* @example
|
561
|
+
* var res = obs = xs.distinct();
|
562
|
+
* 2 - obs = xs.distinct(function (x) { return x.id; });
|
563
|
+
* 2 - obs = xs.distinct(function (x) { return x.id; }, function (a,b) { return a === b; });
|
564
|
+
* @param {Function} [keySelector] A function to compute the comparison key for each element.
|
565
|
+
* @param {Function} [comparer] Used to compare items in the collection.
|
566
|
+
* @returns {Observable} An observable sequence only containing the distinct elements, based on a computed key value, from the source sequence.
|
567
|
+
*/
|
568
|
+
observableProto.distinct = function (keySelector, comparer) {
|
569
|
+
var source = this;
|
570
|
+
comparer || (comparer = defaultComparer);
|
571
|
+
return new AnonymousObservable(function (observer) {
|
572
|
+
var hashSet = new HashSet(comparer);
|
573
|
+
return source.subscribe(function (x) {
|
574
|
+
var key = x;
|
575
|
+
|
576
|
+
if (keySelector) {
|
577
|
+
try {
|
578
|
+
key = keySelector(x);
|
579
|
+
} catch (e) {
|
580
|
+
observer.onError(e);
|
581
|
+
return;
|
582
|
+
}
|
658
583
|
}
|
584
|
+
hashSet.push(key) && observer.onNext(x);
|
585
|
+
},
|
586
|
+
observer.onError.bind(observer),
|
587
|
+
observer.onCompleted.bind(observer));
|
588
|
+
});
|
589
|
+
};
|
659
590
|
|
660
|
-
|
661
|
-
}(Observable));
|
662
|
-
|
663
|
-
return Rx;
|
591
|
+
return Rx;
|
664
592
|
}));
|
@@ -1 +1 @@
|
|
1
|
-
(function(a){var b={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},c=b[typeof window]&&window||this,d=b[typeof exports]&&exports&&!exports.nodeType&&exports,e=b[typeof module]&&module&&!module.nodeType&&module,f=(e&&e.exports===d&&d,b[typeof global]&&global);!f||f.global!==f&&f.window!==f||(c=f),"function"==typeof define&&define.amd?define(["rx","exports"],function(b,d){return c.Rx=a(c,d,b),c.Rx}):"object"==typeof module&&module&&module.exports===d?module.exports=a(c,module.exports,require("./rx")):c.Rx=a(c,{},c.Rx)}).call(this,function(a,b,c,d){function e(a,b){return 1===a.length&&Array.isArray(a[b])?a[b]:C.call(a)}function f(a,b){this.scheduler=a,this.disposable=b,this.isDisposed=!1}var
|
1
|
+
(function(a){var b={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},c=b[typeof window]&&window||this,d=b[typeof exports]&&exports&&!exports.nodeType&&exports,e=b[typeof module]&&module&&!module.nodeType&&module,f=(e&&e.exports===d&&d,b[typeof global]&&global);!f||f.global!==f&&f.window!==f||(c=f),"function"==typeof define&&define.amd?define(["rx","exports"],function(b,d){return c.Rx=a(c,d,b),c.Rx}):"object"==typeof module&&module&&module.exports===d?module.exports=a(c,module.exports,require("./rx")):c.Rx=a(c,{},c.Rx)}).call(this,function(a,b,c,d){function e(a,b){return 1===a.length&&Array.isArray(a[b])?a[b]:C.call(a)}function f(a,b){this.scheduler=a,this.disposable=b,this.isDisposed=!1}function g(a,b,c){for(var d=0,e=a.length;e>d;d++)if(c(a[d],b))return d;return-1}function h(a){this.comparer=a,this.set=[]}var i=c.Observable,j=i.prototype,k=i.never,l=i.throwException,m=c.AnonymousObservable,n=c.Observer,o=c.Subject,p=c.internals,q=c.helpers,r=p.ScheduledObserver,s=c.SingleAssignmentDisposable,t=c.CompositeDisposable,u=c.RefCountDisposable,v=c.Disposable.empty,w=c.Scheduler.immediate,x=(q.defaultKeySerializer,c.internals.addRef),y=(q.identity,q.isPromise),z=p.inherits,A=(q.noop,q.isScheduler),B=i.fromPromise,C=Array.prototype.slice,D="Argument out of range";f.prototype.dispose=function(){var a=this;this.scheduler.schedule(function(){a.isDisposed||(a.isDisposed=!0,a.disposable.dispose())})};var E=(function(a){function b(b){a.call(this),this._observer=b,this._state=0}z(b,a);var c=b.prototype;return c.onNext=function(a){this.checkAccess();try{this._observer.onNext(a)}catch(b){throw b}finally{this._state=0}},c.onError=function(a){this.checkAccess();try{this._observer.onError(a)}catch(b){throw b}finally{this._state=2}},c.onCompleted=function(){this.checkAccess();try{this._observer.onCompleted()}catch(a){throw a}finally{this._state=2}},c.checkAccess=function(){if(1===this._state)throw new Error("Re-entrancy detected");if(2===this._state)throw new Error("Observer completed");0===this._state&&(this._state=1)},b}(n),function(a){function b(){a.apply(this,arguments)}return z(b,a),b.prototype.next=function(b){a.prototype.next.call(this,b),this.ensureActive()},b.prototype.error=function(b){a.prototype.error.call(this,b),this.ensureActive()},b.prototype.completed=function(){a.prototype.completed.call(this),this.ensureActive()},b}(r));j.observeOn=function(a){var b=this;return new m(function(c){return b.subscribe(new E(a,c))})},j.subscribeOn=function(a){var b=this;return new m(function(c){var d=new s,e=new SerialDisposable;return e.setDisposable(d),d.setDisposable(a.schedule(function(){e.setDisposable(new f(a,b.subscribe(c)))})),e})},i.generate=function(a,b,c,d,e){return A(e)||(e=currentThreadScheduler),new m(function(f){var g=!0,h=a;return e.scheduleRecursive(function(a){var e,i;try{g?g=!1:h=c(h),e=b(h),e&&(i=d(h))}catch(j){return void f.onError(j)}e?(f.onNext(i),a()):f.onCompleted()})})},i.using=function(a,b){return new m(function(c){var d,e,f=v;try{d=a(),d&&(f=d),e=b(d)}catch(g){return new t(l(g).subscribe(c),f)}return new t(e.subscribe(c),f)})},j.amb=function(a){var b=this;return new m(function(c){function d(){f||(f=g,j.dispose())}function e(){f||(f=h,i.dispose())}var f,g="L",h="R",i=new s,j=new s;return y(a)&&(a=B(a)),i.setDisposable(b.subscribe(function(a){d(),f===g&&c.onNext(a)},function(a){d(),f===g&&c.onError(a)},function(){d(),f===g&&c.onCompleted()})),j.setDisposable(a.subscribe(function(a){e(),f===h&&c.onNext(a)},function(a){e(),f===h&&c.onError(a)},function(){e(),f===h&&c.onCompleted()})),new t(i,j)})},i.amb=function(){function a(a,b){return a.amb(b)}for(var b=k(),c=e(arguments,0),d=0,f=c.length;f>d;d++)b=a(b,c[d]);return b},j.onErrorResumeNext=function(a){if(!a)throw new Error("Second observable is required");return F([this,a])};var F=i.onErrorResumeNext=function(){var a=e(arguments,0);return new m(function(b){var c=0,d=new SerialDisposable,e=w.scheduleRecursive(function(e){var f,g;c<a.length?(f=a[c++],y(f)&&(f=B(f)),g=new s,d.setDisposable(g),g.setDisposable(f.subscribe(b.onNext.bind(b),function(){e()},function(){e()}))):b.onCompleted()});return new t(d,e)})};return j.bufferWithCount=function(a,b){return"number"!=typeof b&&(b=a),this.windowWithCount(a,b).selectMany(function(a){return a.toArray()}).where(function(a){return a.length>0})},j.windowWithCount=function(a,b){var c=this;if(0>=a)throw new Error(D);if(1===arguments.length&&(b=a),0>=b)throw new Error(D);return new m(function(d){var e=new s,f=new u(e),g=0,h=[],i=function(){var a=new o;h.push(a),d.onNext(x(a,f))};return i(),e.setDisposable(c.subscribe(function(c){for(var d,e=0,f=h.length;f>e;e++)h[e].onNext(c);var j=g-a+1;j>=0&&j%b===0&&(d=h.shift(),d.onCompleted()),g++,g%b===0&&i()},function(a){for(;h.length>0;)h.shift().onError(a);d.onError(a)},function(){for(;h.length>0;)h.shift().onCompleted();d.onCompleted()})),f})},j.takeLastBuffer=function(a){var b=this;return new m(function(c){var d=[];return b.subscribe(function(b){d.push(b),d.length>a&&d.shift()},c.onError.bind(c),function(){c.onNext(d),c.onCompleted()})})},j.defaultIfEmpty=function(a){var b=this;return a===d&&(a=null),new m(function(c){var d=!1;return b.subscribe(function(a){d=!0,c.onNext(a)},c.onError.bind(c),function(){d||c.onNext(a),c.onCompleted()})})},h.prototype.push=function(a){var b=-1===g(this.set,a,this.comparer);return b&&this.set.push(a),b},j.distinct=function(a,b){var c=this;return b||(b=defaultComparer),new m(function(d){var e=new h(b);return c.subscribe(function(b){var c=b;if(a)try{c=a(b)}catch(f){return void d.onError(f)}e.push(c)&&d.onNext(b)},d.onError.bind(d),d.onCompleted.bind(d))})},c});
|