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 (factory) {
|
4
4
|
var objectTypes = {
|
@@ -15,16 +15,15 @@
|
|
15
15
|
freeModule = objectTypes[typeof module] && module && !module.nodeType && module,
|
16
16
|
moduleExports = freeModule && freeModule.exports === freeExports && freeExports,
|
17
17
|
freeGlobal = objectTypes[typeof global] && global;
|
18
|
-
|
18
|
+
|
19
19
|
if (freeGlobal && (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal)) {
|
20
20
|
root = freeGlobal;
|
21
21
|
}
|
22
22
|
|
23
23
|
// Because of build optimizers
|
24
24
|
if (typeof define === 'function' && define.amd) {
|
25
|
-
define(['rx'
|
26
|
-
|
27
|
-
return root.Rx;
|
25
|
+
define(['rx'], function (Rx, exports) {
|
26
|
+
return factory(root, exports, Rx);
|
28
27
|
});
|
29
28
|
} else if (typeof module === 'object' && module && module.exports === freeExports) {
|
30
29
|
module.exports = factory(root, module.exports, require('./rx'));
|
@@ -32,26 +31,27 @@
|
|
32
31
|
root.Rx = factory(root, {}, root.Rx);
|
33
32
|
}
|
34
33
|
}.call(this, function (root, exp, Rx, undefined) {
|
35
|
-
|
36
|
-
var Observable = Rx.Observable,
|
37
|
-
CompositeDisposable = Rx.CompositeDisposable,
|
38
|
-
RefCountDisposable = Rx.RefCountDisposable,
|
39
|
-
SingleAssignmentDisposable = Rx.SingleAssignmentDisposable,
|
40
|
-
SerialDisposable = Rx.SerialDisposable,
|
41
|
-
Subject = Rx.Subject,
|
42
|
-
observableProto = Observable.prototype,
|
43
|
-
observableEmpty = Observable.empty,
|
44
|
-
observableNever = Observable.never,
|
45
|
-
AnonymousObservable = Rx.AnonymousObservable,
|
46
|
-
observerCreate = Rx.Observer.create,
|
47
|
-
addRef = Rx.internals.addRef,
|
48
|
-
defaultComparer = Rx.internals.isEqual,
|
49
|
-
noop = Rx.helpers.noop,
|
50
|
-
identity = Rx.helpers.identity
|
51
|
-
|
52
|
-
|
34
|
+
|
35
|
+
var Observable = Rx.Observable,
|
36
|
+
CompositeDisposable = Rx.CompositeDisposable,
|
37
|
+
RefCountDisposable = Rx.RefCountDisposable,
|
38
|
+
SingleAssignmentDisposable = Rx.SingleAssignmentDisposable,
|
39
|
+
SerialDisposable = Rx.SerialDisposable,
|
40
|
+
Subject = Rx.Subject,
|
41
|
+
observableProto = Observable.prototype,
|
42
|
+
observableEmpty = Observable.empty,
|
43
|
+
observableNever = Observable.never,
|
44
|
+
AnonymousObservable = Rx.AnonymousObservable,
|
45
|
+
observerCreate = Rx.Observer.create,
|
46
|
+
addRef = Rx.internals.addRef,
|
47
|
+
defaultComparer = Rx.internals.isEqual,
|
48
|
+
noop = Rx.helpers.noop,
|
49
|
+
identity = Rx.helpers.identity,
|
50
|
+
isPromise = Rx.helpers.isPromise,
|
51
|
+
observableFromPromise = Observable.fromPromise;
|
52
|
+
|
53
53
|
var Dictionary = (function () {
|
54
|
-
|
54
|
+
|
55
55
|
var primes = [1, 3, 7, 13, 31, 61, 127, 251, 509, 1021, 2039, 4093, 8191, 16381, 32749, 65521, 131071, 262139, 524287, 1048573, 2097143, 4194301, 8388593, 16777213, 33554393, 67108859, 134217689, 268435399, 536870909, 1073741789, 2147483647],
|
56
56
|
noSuchkey = "no such key",
|
57
57
|
duplicatekey = "duplicate key";
|
@@ -93,7 +93,7 @@
|
|
93
93
|
}
|
94
94
|
|
95
95
|
function numberHashFn(key) {
|
96
|
-
var c2 = 0x27d4eb2d;
|
96
|
+
var c2 = 0x27d4eb2d;
|
97
97
|
key = (key ^ 61) ^ (key >>> 16);
|
98
98
|
key = key + (key << 3);
|
99
99
|
key = key ^ (key >>> 4);
|
@@ -135,7 +135,7 @@
|
|
135
135
|
function Dictionary(capacity, comparer) {
|
136
136
|
if (capacity < 0) { throw new Error('out of range'); }
|
137
137
|
if (capacity > 0) { this._initialize(capacity); }
|
138
|
-
|
138
|
+
|
139
139
|
this.comparer = comparer || defaultComparer;
|
140
140
|
this.freeCount = 0;
|
141
141
|
this.size = 0;
|
@@ -296,17 +296,17 @@
|
|
296
296
|
};
|
297
297
|
|
298
298
|
return Dictionary;
|
299
|
-
}());
|
299
|
+
}());
|
300
300
|
|
301
301
|
/**
|
302
302
|
* Correlates the elements of two sequences based on overlapping durations.
|
303
|
-
*
|
303
|
+
*
|
304
304
|
* @param {Observable} right The right observable sequence to join elements for.
|
305
305
|
* @param {Function} leftDurationSelector A function to select the duration (expressed as an observable sequence) of each element of the left observable sequence, used to determine overlap.
|
306
306
|
* @param {Function} rightDurationSelector A function to select the duration (expressed as an observable sequence) of each element of the right observable sequence, used to determine overlap.
|
307
307
|
* @param {Function} resultSelector A function invoked to compute a result element for any two overlapping elements of the left and right observable sequences. The parameters passed to the function correspond with the elements from the left and right source sequences for which overlap occurs.
|
308
308
|
* @returns {Observable} An observable sequence that contains result elements computed from source elements that have an overlapping duration.
|
309
|
-
*/
|
309
|
+
*/
|
310
310
|
observableProto.join = function (right, leftDurationSelector, rightDurationSelector, resultSelector) {
|
311
311
|
var left = this;
|
312
312
|
return new AnonymousObservable(function (observer) {
|
@@ -322,12 +322,12 @@
|
|
322
322
|
|
323
323
|
leftMap.add(id, value);
|
324
324
|
group.add(md);
|
325
|
-
|
325
|
+
|
326
326
|
var expire = function () {
|
327
327
|
leftMap.remove(id) && leftMap.count() === 0 && leftDone && observer.onCompleted();
|
328
328
|
group.remove(md);
|
329
329
|
};
|
330
|
-
|
330
|
+
|
331
331
|
var duration;
|
332
332
|
try {
|
333
333
|
duration = leftDurationSelector(value);
|
@@ -349,8 +349,8 @@
|
|
349
349
|
|
350
350
|
observer.onNext(result);
|
351
351
|
});
|
352
|
-
},
|
353
|
-
observer.onError.bind(observer),
|
352
|
+
},
|
353
|
+
observer.onError.bind(observer),
|
354
354
|
function () {
|
355
355
|
leftDone = true;
|
356
356
|
(rightDone || leftMap.count() === 0) && observer.onCompleted();
|
@@ -391,8 +391,8 @@
|
|
391
391
|
|
392
392
|
observer.onNext(result);
|
393
393
|
});
|
394
|
-
},
|
395
|
-
observer.onError.bind(observer),
|
394
|
+
},
|
395
|
+
observer.onError.bind(observer),
|
396
396
|
function () {
|
397
397
|
rightDone = true;
|
398
398
|
(leftDone || rightMap.count() === 0) && observer.onCompleted();
|
@@ -404,13 +404,13 @@
|
|
404
404
|
|
405
405
|
/**
|
406
406
|
* Correlates the elements of two sequences based on overlapping durations, and groups the results.
|
407
|
-
*
|
407
|
+
*
|
408
408
|
* @param {Observable} right The right observable sequence to join elements for.
|
409
409
|
* @param {Function} leftDurationSelector A function to select the duration (expressed as an observable sequence) of each element of the left observable sequence, used to determine overlap.
|
410
410
|
* @param {Function} rightDurationSelector A function to select the duration (expressed as an observable sequence) of each element of the right observable sequence, used to determine overlap.
|
411
411
|
* @param {Function} resultSelector A function invoked to compute a result element for any element of the left sequence with overlapping elements from the right observable sequence. The first parameter passed to the function is an element of the left sequence. The second parameter passed to the function is an observable sequence with elements from the right sequence that overlap with the left sequence's element.
|
412
412
|
* @returns {Observable} An observable sequence that contains result elements computed from source elements that have an overlapping duration.
|
413
|
-
*/
|
413
|
+
*/
|
414
414
|
observableProto.groupJoin = function (right, leftDurationSelector, rightDurationSelector, resultSelector) {
|
415
415
|
var left = this;
|
416
416
|
return new AnonymousObservable(function (observer) {
|
@@ -516,120 +516,124 @@
|
|
516
516
|
|
517
517
|
/**
|
518
518
|
* Projects each element of an observable sequence into zero or more buffers.
|
519
|
-
*
|
519
|
+
*
|
520
520
|
* @param {Mixed} bufferOpeningsOrClosingSelector Observable sequence whose elements denote the creation of new windows, or, a function invoked to define the boundaries of the produced windows (a new window is started when the previous one is closed, resulting in non-overlapping windows).
|
521
521
|
* @param {Function} [bufferClosingSelector] A function invoked to define the closing of each produced window. If a closing selector function is specified for the first parameter, this parameter is ignored.
|
522
|
-
* @returns {Observable} An observable sequence of windows.
|
522
|
+
* @returns {Observable} An observable sequence of windows.
|
523
523
|
*/
|
524
524
|
observableProto.buffer = function (bufferOpeningsOrClosingSelector, bufferClosingSelector) {
|
525
525
|
return this.window.apply(this, arguments).selectMany(function (x) { return x.toArray(); });
|
526
526
|
};
|
527
527
|
|
528
|
-
|
529
|
-
|
530
|
-
|
531
|
-
|
532
|
-
|
533
|
-
|
534
|
-
|
535
|
-
|
536
|
-
|
537
|
-
|
538
|
-
}
|
539
|
-
return typeof windowOpeningsOrClosingSelector === 'function' ?
|
540
|
-
observableWindowWithClosingSelector.call(this, windowOpeningsOrClosingSelector) :
|
541
|
-
observableWindowWithOpenings.call(this, windowOpeningsOrClosingSelector, windowClosingSelector);
|
542
|
-
};
|
543
|
-
|
544
|
-
function observableWindowWithOpenings(windowOpenings, windowClosingSelector) {
|
545
|
-
return windowOpenings.groupJoin(this, windowClosingSelector, function () {
|
546
|
-
return observableEmpty();
|
547
|
-
}, function (_, window) {
|
548
|
-
return window;
|
549
|
-
});
|
528
|
+
/**
|
529
|
+
* Projects each element of an observable sequence into zero or more windows.
|
530
|
+
*
|
531
|
+
* @param {Mixed} windowOpeningsOrClosingSelector Observable sequence whose elements denote the creation of new windows, or, a function invoked to define the boundaries of the produced windows (a new window is started when the previous one is closed, resulting in non-overlapping windows).
|
532
|
+
* @param {Function} [windowClosingSelector] A function invoked to define the closing of each produced window. If a closing selector function is specified for the first parameter, this parameter is ignored.
|
533
|
+
* @returns {Observable} An observable sequence of windows.
|
534
|
+
*/
|
535
|
+
observableProto.window = function (windowOpeningsOrClosingSelector, windowClosingSelector) {
|
536
|
+
if (arguments.length === 1 && typeof arguments[0] !== 'function') {
|
537
|
+
return observableWindowWithBounaries.call(this, windowOpeningsOrClosingSelector);
|
550
538
|
}
|
539
|
+
return typeof windowOpeningsOrClosingSelector === 'function' ?
|
540
|
+
observableWindowWithClosingSelector.call(this, windowOpeningsOrClosingSelector) :
|
541
|
+
observableWindowWithOpenings.call(this, windowOpeningsOrClosingSelector, windowClosingSelector);
|
542
|
+
};
|
551
543
|
|
552
|
-
|
553
|
-
|
554
|
-
|
555
|
-
|
556
|
-
|
557
|
-
r = new RefCountDisposable(d);
|
558
|
-
|
559
|
-
observer.onNext(addRef(window, r));
|
560
|
-
|
561
|
-
d.add(source.subscribe(function (x) {
|
562
|
-
window.onNext(x);
|
563
|
-
}, function (err) {
|
564
|
-
window.onError(err);
|
565
|
-
observer.onError(err);
|
566
|
-
}, function () {
|
567
|
-
window.onCompleted();
|
568
|
-
observer.onCompleted();
|
569
|
-
}));
|
570
|
-
|
571
|
-
d.add(windowBoundaries.subscribe(function (w) {
|
572
|
-
window.onCompleted();
|
573
|
-
window = new Subject();
|
574
|
-
observer.onNext(addRef(window, r));
|
575
|
-
}, function (err) {
|
576
|
-
window.onError(err);
|
577
|
-
observer.onError(err);
|
578
|
-
}, function () {
|
579
|
-
window.onCompleted();
|
580
|
-
observer.onCompleted();
|
581
|
-
}));
|
582
|
-
|
583
|
-
return r;
|
584
|
-
});
|
585
|
-
}
|
544
|
+
function observableWindowWithOpenings(windowOpenings, windowClosingSelector) {
|
545
|
+
return windowOpenings.groupJoin(this, windowClosingSelector, observableEmpty, function (_, win) {
|
546
|
+
return win;
|
547
|
+
});
|
548
|
+
}
|
586
549
|
|
587
|
-
|
588
|
-
|
589
|
-
|
590
|
-
|
591
|
-
|
592
|
-
|
593
|
-
|
594
|
-
|
595
|
-
|
596
|
-
|
597
|
-
|
598
|
-
|
599
|
-
|
600
|
-
|
601
|
-
|
602
|
-
|
603
|
-
|
604
|
-
|
605
|
-
|
606
|
-
|
607
|
-
|
608
|
-
|
609
|
-
|
610
|
-
|
611
|
-
|
612
|
-
|
613
|
-
|
614
|
-
|
615
|
-
|
616
|
-
|
617
|
-
|
618
|
-
|
619
|
-
|
620
|
-
|
621
|
-
|
622
|
-
|
623
|
-
|
624
|
-
|
625
|
-
|
626
|
-
|
627
|
-
|
628
|
-
|
550
|
+
function observableWindowWithBounaries(windowBoundaries) {
|
551
|
+
var source = this;
|
552
|
+
return new AnonymousObservable(function (observer) {
|
553
|
+
var win = new Subject(),
|
554
|
+
d = new CompositeDisposable(),
|
555
|
+
r = new RefCountDisposable(d);
|
556
|
+
|
557
|
+
observer.onNext(addRef(win, r));
|
558
|
+
|
559
|
+
d.add(source.subscribe(function (x) {
|
560
|
+
win.onNext(x);
|
561
|
+
}, function (err) {
|
562
|
+
win.onError(err);
|
563
|
+
observer.onError(err);
|
564
|
+
}, function () {
|
565
|
+
win.onCompleted();
|
566
|
+
observer.onCompleted();
|
567
|
+
}));
|
568
|
+
|
569
|
+
isPromise(windowBoundaries) && (windowBoundaries = observableFromPromise(windowBoundaries));
|
570
|
+
|
571
|
+
d.add(windowBoundaries.subscribe(function (w) {
|
572
|
+
win.onCompleted();
|
573
|
+
win = new Subject();
|
574
|
+
observer.onNext(addRef(win, r));
|
575
|
+
}, function (err) {
|
576
|
+
win.onError(err);
|
577
|
+
observer.onError(err);
|
578
|
+
}, function () {
|
579
|
+
win.onCompleted();
|
580
|
+
observer.onCompleted();
|
581
|
+
}));
|
582
|
+
|
583
|
+
return r;
|
584
|
+
});
|
585
|
+
}
|
586
|
+
|
587
|
+
function observableWindowWithClosingSelector(windowClosingSelector) {
|
588
|
+
var source = this;
|
589
|
+
return new AnonymousObservable(function (observer) {
|
590
|
+
var m = new SerialDisposable(),
|
591
|
+
d = new CompositeDisposable(m),
|
592
|
+
r = new RefCountDisposable(d),
|
593
|
+
win = new Subject();
|
594
|
+
observer.onNext(addRef(win, r));
|
595
|
+
d.add(source.subscribe(function (x) {
|
596
|
+
win.onNext(x);
|
597
|
+
}, function (err) {
|
598
|
+
win.onError(err);
|
599
|
+
observer.onError(err);
|
600
|
+
}, function () {
|
601
|
+
win.onCompleted();
|
602
|
+
observer.onCompleted();
|
603
|
+
}));
|
604
|
+
|
605
|
+
function createWindowClose () {
|
606
|
+
var windowClose;
|
607
|
+
try {
|
608
|
+
windowClose = windowClosingSelector();
|
609
|
+
} catch (e) {
|
610
|
+
observer.onError(e);
|
611
|
+
return;
|
612
|
+
}
|
613
|
+
|
614
|
+
isPromise(windowClose) && (windowClose = observableFromPromise(windowClose));
|
615
|
+
|
616
|
+
var m1 = new SingleAssignmentDisposable();
|
617
|
+
m.setDisposable(m1);
|
618
|
+
m1.setDisposable(windowClose.take(1).subscribe(noop, function (err) {
|
619
|
+
win.onError(err);
|
620
|
+
observer.onError(err);
|
621
|
+
}, function () {
|
622
|
+
win.onCompleted();
|
623
|
+
win = new Subject();
|
624
|
+
observer.onNext(addRef(win, r));
|
625
|
+
createWindowClose();
|
626
|
+
}));
|
627
|
+
}
|
628
|
+
|
629
|
+
createWindowClose();
|
630
|
+
return r;
|
631
|
+
});
|
632
|
+
}
|
629
633
|
|
630
634
|
/**
|
631
|
-
* Returns a new observable that triggers on the second and subsequent triggerings of the input observable.
|
632
|
-
* The Nth triggering of the input observable passes the arguments from the N-1th and Nth triggering as a pair.
|
635
|
+
* Returns a new observable that triggers on the second and subsequent triggerings of the input observable.
|
636
|
+
* The Nth triggering of the input observable passes the arguments from the N-1th and Nth triggering as a pair.
|
633
637
|
* The argument passed to the N-1th triggering is held in hidden internal state until the Nth triggering occurs.
|
634
638
|
* @returns {Observable} An observable that triggers on successive pairs of observations from the input observable as an array.
|
635
639
|
*/
|
@@ -650,30 +654,31 @@
|
|
650
654
|
observer.onCompleted.bind(observer));
|
651
655
|
});
|
652
656
|
};
|
653
|
-
|
657
|
+
|
658
|
+
/**
|
654
659
|
* Returns two observables which partition the observations of the source by the given function.
|
655
|
-
* The first will trigger observations for those values for which the predicate returns true.
|
656
|
-
* The second will trigger observations for those values where the predicate returns false.
|
657
|
-
* The predicate is executed once for each subscribed observer.
|
658
|
-
* Both also propagate all error observations arising from the source and each completes
|
660
|
+
* The first will trigger observations for those values for which the predicate returns true.
|
661
|
+
* The second will trigger observations for those values where the predicate returns false.
|
662
|
+
* The predicate is executed once for each subscribed observer.
|
663
|
+
* Both also propagate all error observations arising from the source and each completes
|
659
664
|
* when the source completes.
|
660
|
-
* @param {Function} predicate
|
665
|
+
* @param {Function} predicate
|
661
666
|
* The function to determine which output Observable will trigger a particular observation.
|
662
667
|
* @returns {Array}
|
663
|
-
* An array of observables. The first triggers when the predicate returns true,
|
668
|
+
* An array of observables. The first triggers when the predicate returns true,
|
664
669
|
* and the second triggers when the predicate returns false.
|
665
670
|
*/
|
666
671
|
observableProto.partition = function(predicate, thisArg) {
|
667
672
|
var published = this.publish().refCount();
|
668
|
-
return [
|
669
|
-
published.filter(predicate, thisArg),
|
673
|
+
return [
|
674
|
+
published.filter(predicate, thisArg),
|
670
675
|
published.filter(function (x, i, o) { return !predicate.call(thisArg, x, i, o); })
|
671
676
|
];
|
672
677
|
};
|
673
678
|
|
674
679
|
/**
|
675
680
|
* 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.
|
676
|
-
*
|
681
|
+
*
|
677
682
|
* @example
|
678
683
|
* var res = observable.groupBy(function (x) { return x.id; });
|
679
684
|
* 2 - observable.groupBy(function (x) { return x.id; }), function (x) { return x.name; });
|
@@ -681,7 +686,7 @@
|
|
681
686
|
* @param {Function} keySelector A function to extract the key for each element.
|
682
687
|
* @param {Function} [elementSelector] A function to map each source element to an element in an observable group.
|
683
688
|
* @param {Function} [comparer] Used to determine whether the objects are equal.
|
684
|
-
* @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.
|
689
|
+
* @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.
|
685
690
|
*/
|
686
691
|
observableProto.groupBy = function (keySelector, elementSelector, comparer) {
|
687
692
|
return this.groupByUntil(keySelector, elementSelector, observableNever, comparer);
|
@@ -691,7 +696,7 @@
|
|
691
696
|
* Groups the elements of an observable sequence according to a specified key selector function.
|
692
697
|
* 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
|
693
698
|
* key value as a reclaimed group occurs, the group will be reborn with a new lifetime request.
|
694
|
-
*
|
699
|
+
*
|
695
700
|
* @example
|
696
701
|
* var res = observable.groupByUntil(function (x) { return x.id; }, null, function () { return Rx.Observable.never(); });
|
697
702
|
* 2 - observable.groupBy(function (x) { return x.id; }), function (x) { return x.name; }, function () { return Rx.Observable.never(); });
|
@@ -699,10 +704,10 @@
|
|
699
704
|
* @param {Function} keySelector A function to extract the key for each element.
|
700
705
|
* @param {Function} durationSelector A function to signal the expiration of a group.
|
701
706
|
* @param {Function} [comparer] Used to compare objects. When not specified, the default comparer is used.
|
702
|
-
* @returns {Observable}
|
707
|
+
* @returns {Observable}
|
703
708
|
* A sequence of observable groups, each of which corresponds to a unique key value, containing all elements that share that same key value.
|
704
709
|
* 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.
|
705
|
-
*
|
710
|
+
*
|
706
711
|
*/
|
707
712
|
observableProto.groupByUntil = function (keySelector, elementSelector, durationSelector, comparer) {
|
708
713
|
var source = this;
|
@@ -744,21 +749,21 @@
|
|
744
749
|
}
|
745
750
|
|
746
751
|
observer.onNext(group);
|
747
|
-
|
752
|
+
|
748
753
|
var md = new SingleAssignmentDisposable();
|
749
754
|
groupDisposable.add(md);
|
750
|
-
|
755
|
+
|
751
756
|
var expire = function () {
|
752
757
|
map.remove(key) && writer.onCompleted();
|
753
758
|
groupDisposable.remove(md);
|
754
759
|
};
|
755
760
|
|
756
761
|
md.setDisposable(duration.take(1).subscribe(
|
757
|
-
noop,
|
762
|
+
noop,
|
758
763
|
function (exn) {
|
759
764
|
map.getValues().forEach(handleError(exn));
|
760
765
|
observer.onError(exn);
|
761
|
-
},
|
766
|
+
},
|
762
767
|
expire)
|
763
768
|
);
|
764
769
|
}
|
@@ -785,25 +790,25 @@
|
|
785
790
|
});
|
786
791
|
};
|
787
792
|
|
788
|
-
var GroupedObservable = (function (__super__) {
|
789
|
-
inherits(GroupedObservable, __super__);
|
790
|
-
|
791
|
-
function subscribe(observer) {
|
792
|
-
return this.underlyingObservable.subscribe(observer);
|
793
|
-
}
|
794
|
-
|
795
|
-
function GroupedObservable(key, underlyingObservable, mergedDisposable) {
|
796
|
-
__super__.call(this, subscribe);
|
797
|
-
this.key = key;
|
798
|
-
this.underlyingObservable = !mergedDisposable ?
|
799
|
-
underlyingObservable :
|
800
|
-
new AnonymousObservable(function (observer) {
|
801
|
-
return new CompositeDisposable(mergedDisposable.getDisposable(), underlyingObservable.subscribe(observer));
|
802
|
-
});
|
803
|
-
}
|
804
|
-
|
805
|
-
return GroupedObservable;
|
806
|
-
}(Observable));
|
807
|
-
|
808
|
-
return Rx;
|
809
|
-
}));
|
793
|
+
var GroupedObservable = (function (__super__) {
|
794
|
+
inherits(GroupedObservable, __super__);
|
795
|
+
|
796
|
+
function subscribe(observer) {
|
797
|
+
return this.underlyingObservable.subscribe(observer);
|
798
|
+
}
|
799
|
+
|
800
|
+
function GroupedObservable(key, underlyingObservable, mergedDisposable) {
|
801
|
+
__super__.call(this, subscribe);
|
802
|
+
this.key = key;
|
803
|
+
this.underlyingObservable = !mergedDisposable ?
|
804
|
+
underlyingObservable :
|
805
|
+
new AnonymousObservable(function (observer) {
|
806
|
+
return new CompositeDisposable(mergedDisposable.getDisposable(), underlyingObservable.subscribe(observer));
|
807
|
+
});
|
808
|
+
}
|
809
|
+
|
810
|
+
return GroupedObservable;
|
811
|
+
}(Observable));
|
812
|
+
|
813
|
+
return Rx;
|
814
|
+
}));
|
@@ -1 +1,3 @@
|
|
1
|
-
|
1
|
+
/* Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.*/
|
2
|
+
(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"],function(b,d){return a(c,d,b)}):"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 a.groupJoin(this,b,o,function(a,b){return b})}function f(a){var b=this;return new q(function(c){var d=new m,e=new i,f=new j(e);return c.onNext(r(d,f)),e.add(b.subscribe(function(a){d.onNext(a)},function(a){d.onError(a),c.onError(a)},function(){d.onCompleted(),c.onCompleted()})),v(a)&&(a=w(a)),e.add(a.subscribe(function(){d.onCompleted(),d=new m,c.onNext(r(d,f))},function(a){d.onError(a),c.onError(a)},function(){d.onCompleted(),c.onCompleted()})),f})}function g(a){var b=this;return new q(function(c){function d(){var b;try{b=a()}catch(f){return void c.onError(f)}v(b)&&(b=w(b));var i=new k;e.setDisposable(i),i.setDisposable(b.take(1).subscribe(t,function(a){h.onError(a),c.onError(a)},function(){h.onCompleted(),h=new m,c.onNext(r(h,g)),d()}))}var e=new l,f=new i(e),g=new j(f),h=new m;return c.onNext(r(h,g)),f.add(b.subscribe(function(a){h.onNext(a)},function(a){h.onError(a),c.onError(a)},function(){h.onCompleted(),c.onCompleted()})),d(),g})}var h=c.Observable,i=c.CompositeDisposable,j=c.RefCountDisposable,k=c.SingleAssignmentDisposable,l=c.SerialDisposable,m=c.Subject,n=h.prototype,o=h.empty,p=h.never,q=c.AnonymousObservable,r=(c.Observer.create,c.internals.addRef),s=c.internals.isEqual,t=c.helpers.noop,u=c.helpers.identity,v=c.helpers.isPromise,w=h.fromPromise,x=function(){function a(a){if(a&!1)return 2===a;for(var b=Math.sqrt(a),c=3;b>=c;){if(a%c===0)return!1;c+=2}return!0}function b(b){var c,d,e;for(c=0;c<h.length;++c)if(d=h[c],d>=b)return d;for(e=1|b;e<h[h.length-1];){if(a(e))return e;e+=2}return b}function c(a){var b=757602046;if(!a.length)return b;for(var c=0,d=a.length;d>c;c++){var e=a.charCodeAt(c);b=(b<<5)-b+e,b&=b}return b}function e(a){var b=668265261;return a=61^a^a>>>16,a+=a<<3,a^=a>>>4,a*=b,a^=a>>>15}function f(){return{key:null,value:null,next:0,hashCode:0}}function g(a,b){if(0>a)throw new Error("out of range");a>0&&this._initialize(a),this.comparer=b||s,this.freeCount=0,this.size=0,this.freeList=-1}var h=[1,3,7,13,31,61,127,251,509,1021,2039,4093,8191,16381,32749,65521,131071,262139,524287,1048573,2097143,4194301,8388593,16777213,33554393,67108859,134217689,268435399,536870909,1073741789,2147483647],i="no such key",j="duplicate key",k=function(){var a=0;return function(b){if(null==b)throw new Error(i);if("string"==typeof b)return c(b);if("number"==typeof b)return e(b);if("boolean"==typeof b)return b===!0?1:0;if(b instanceof Date)return e(b.valueOf());if(b instanceof RegExp)return c(b.toString());if("function"==typeof b.valueOf){var d=b.valueOf();if("number"==typeof d)return e(d);if("string"==typeof b)return c(d)}if(b.getHashCode)return b.getHashCode();var f=17*a++;return b.getHashCode=function(){return f},f}}(),l=g.prototype;return l._initialize=function(a){var c,d=b(a);for(this.buckets=new Array(d),this.entries=new Array(d),c=0;d>c;c++)this.buckets[c]=-1,this.entries[c]=f();this.freeList=-1},l.add=function(a,b){return this._insert(a,b,!0)},l._insert=function(a,b,c){this.buckets||this._initialize(0);for(var d,e=2147483647&k(a),f=e%this.buckets.length,g=this.buckets[f];g>=0;g=this.entries[g].next)if(this.entries[g].hashCode===e&&this.comparer(this.entries[g].key,a)){if(c)throw new Error(j);return void(this.entries[g].value=b)}this.freeCount>0?(d=this.freeList,this.freeList=this.entries[d].next,--this.freeCount):(this.size===this.entries.length&&(this._resize(),f=e%this.buckets.length),d=this.size,++this.size),this.entries[d].hashCode=e,this.entries[d].next=this.buckets[f],this.entries[d].key=a,this.entries[d].value=b,this.buckets[f]=d},l._resize=function(){var a=b(2*this.size),c=new Array(a);for(e=0;e<c.length;++e)c[e]=-1;var d=new Array(a);for(e=0;e<this.size;++e)d[e]=this.entries[e];for(var e=this.size;a>e;++e)d[e]=f();for(var g=0;g<this.size;++g){var h=d[g].hashCode%a;d[g].next=c[h],c[h]=g}this.buckets=c,this.entries=d},l.remove=function(a){if(this.buckets)for(var b=2147483647&k(a),c=b%this.buckets.length,d=-1,e=this.buckets[c];e>=0;e=this.entries[e].next){if(this.entries[e].hashCode===b&&this.comparer(this.entries[e].key,a))return 0>d?this.buckets[c]=this.entries[e].next:this.entries[d].next=this.entries[e].next,this.entries[e].hashCode=-1,this.entries[e].next=this.freeList,this.entries[e].key=null,this.entries[e].value=null,this.freeList=e,++this.freeCount,!0;d=e}return!1},l.clear=function(){var a,b;if(!(this.size<=0)){for(a=0,b=this.buckets.length;b>a;++a)this.buckets[a]=-1;for(a=0;a<this.size;++a)this.entries[a]=f();this.freeList=-1,this.size=0}},l._findEntry=function(a){if(this.buckets)for(var b=2147483647&k(a),c=this.buckets[b%this.buckets.length];c>=0;c=this.entries[c].next)if(this.entries[c].hashCode===b&&this.comparer(this.entries[c].key,a))return c;return-1},l.count=function(){return this.size-this.freeCount},l.tryGetValue=function(a){var b=this._findEntry(a);return b>=0?this.entries[b].value:d},l.getValues=function(){var a=0,b=[];if(this.entries)for(var c=0;c<this.size;c++)this.entries[c].hashCode>=0&&(b[a++]=this.entries[c].value);return b},l.get=function(a){var b=this._findEntry(a);if(b>=0)return this.entries[b].value;throw new Error(i)},l.set=function(a,b){this._insert(a,b,!1)},l.containskey=function(a){return this._findEntry(a)>=0},g}();n.join=function(a,b,c,d){var e=this;return new q(function(f){var g=new i,h=!1,j=!1,l=0,m=0,n=new x,o=new x;return g.add(e.subscribe(function(a){var c=l++,e=new k;n.add(c,a),g.add(e);var i,j=function(){n.remove(c)&&0===n.count()&&h&&f.onCompleted(),g.remove(e)};try{i=b(a)}catch(m){return void f.onError(m)}e.setDisposable(i.take(1).subscribe(t,f.onError.bind(f),j)),o.getValues().forEach(function(b){var c;try{c=d(a,b)}catch(e){return void f.onError(e)}f.onNext(c)})},f.onError.bind(f),function(){h=!0,(j||0===n.count())&&f.onCompleted()})),g.add(a.subscribe(function(a){var b=m++,e=new k;o.add(b,a),g.add(e);var h,i=function(){o.remove(b)&&0===o.count()&&j&&f.onCompleted(),g.remove(e)};try{h=c(a)}catch(l){return void f.onError(l)}e.setDisposable(h.take(1).subscribe(t,f.onError.bind(f),i)),n.getValues().forEach(function(b){var c;try{c=d(b,a)}catch(e){return void f.onError(e)}f.onNext(c)})},f.onError.bind(f),function(){j=!0,(h||0===o.count())&&f.onCompleted()})),g})},n.groupJoin=function(a,b,c,d){var e=this;return new q(function(f){function g(a){return function(b){b.onError(a)}}var h=new i,l=new j(h),n=new x,o=new x,p=0,q=0;return h.add(e.subscribe(function(a){var c=new m,e=p++;n.add(e,c);var i;try{i=d(a,r(c,l))}catch(j){return n.getValues().forEach(g(j)),void f.onError(j)}f.onNext(i),o.getValues().forEach(function(a){c.onNext(a)});var q=new k;h.add(q);var s,u=function(){n.remove(e)&&c.onCompleted(),h.remove(q)};try{s=b(a)}catch(j){return n.getValues().forEach(g(j)),void f.onError(j)}q.setDisposable(s.take(1).subscribe(t,function(a){n.getValues().forEach(g(a)),f.onError(a)},u))},function(a){n.getValues().forEach(g(a)),f.onError(a)},f.onCompleted.bind(f))),h.add(a.subscribe(function(a){var b=q++;o.add(b,a);var d=new k;h.add(d);var e,i=function(){o.remove(b),h.remove(d)};try{e=c(a)}catch(j){return n.getValues().forEach(g(j)),void f.onError(j)}d.setDisposable(e.take(1).subscribe(t,function(a){n.getValues().forEach(g(a)),f.onError(a)},i)),n.getValues().forEach(function(b){b.onNext(a)})},function(a){n.getValues().forEach(g(a)),f.onError(a)})),l})},n.buffer=function(){return this.window.apply(this,arguments).selectMany(function(a){return a.toArray()})},n.window=function(a,b){return 1===arguments.length&&"function"!=typeof arguments[0]?f.call(this,a):"function"==typeof a?g.call(this,a):e.call(this,a,b)},n.pairwise=function(){var a=this;return new q(function(b){var c,d=!1;return a.subscribe(function(a){d?b.onNext([c,a]):d=!0,c=a},b.onError.bind(b),b.onCompleted.bind(b))})},n.partition=function(a,b){var c=this.publish().refCount();return[c.filter(a,b),c.filter(function(c,d,e){return!a.call(b,c,d,e)})]},n.groupBy=function(a,b,c){return this.groupByUntil(a,b,p,c)},n.groupByUntil=function(a,b,c,d){var e=this;return b||(b=u),d||(d=s),new q(function(f){function g(a){return function(b){b.onError(a)}}var h=new x(0,d),l=new i,n=new j(l);return l.add(e.subscribe(function(d){var e;try{e=a(d)}catch(i){return h.getValues().forEach(g(i)),void f.onError(i)}var j=!1,o=h.tryGetValue(e);if(o||(o=new m,h.set(e,o),j=!0),j){var p=new y(e,o,n),q=new y(e,o);try{duration=c(q)}catch(i){return h.getValues().forEach(g(i)),void f.onError(i)}f.onNext(p);var r=new k;l.add(r);var s=function(){h.remove(e)&&o.onCompleted(),l.remove(r)};r.setDisposable(duration.take(1).subscribe(t,function(a){h.getValues().forEach(g(a)),f.onError(a)},s))}var u;try{u=b(d)}catch(i){return h.getValues().forEach(g(i)),void f.onError(i)}o.onNext(u)},function(a){h.getValues().forEach(g(a)),f.onError(a)},function(){h.getValues().forEach(function(a){a.onCompleted()}),f.onCompleted()})),n})};var y=function(a){function b(a){return this.underlyingObservable.subscribe(a)}function c(c,d,e){a.call(this,b),this.key=c,this.underlyingObservable=e?new q(function(a){return new i(e.getDisposable(),d.subscribe(a))}):d}return inherits(c,a),c}(h);return c});
|
3
|
+
//# sourceMappingURL=rx.coincidence.map
|