@@ -4507,15 +4507,41 @@ observableProto.zipIterable = function () {
4507
4507
. filter ( notEmpty ) ;
4508
4508
} ;
4509
4509
4510
+ var DematerializeObservable = ( function ( __super__ ) {
4511
+ inherits ( DematerializeObservable , __super__ ) ;
4512
+ function DematerializeObservable ( source , fn ) {
4513
+ this . source = source ;
4514
+ __super__ . call ( this ) ;
4515
+ }
4516
+
4517
+ DematerializeObservable . prototype . subscribeCore = function ( o ) {
4518
+ return this . source . subscribe ( new DematerializeObserver ( o ) ) ;
4519
+ } ;
4520
+
4521
+ return DematerializeObservable ;
4522
+ } ( ObservableBase ) ) ;
4523
+
4524
+ var DematerializeObserver = ( function ( __super__ ) {
4525
+ inherits ( DematerializeObserver , __super__ ) ;
4526
+
4527
+ function DematerializeObserver ( o ) {
4528
+ this . _o = o ;
4529
+ __super__ . call ( this ) ;
4530
+ }
4531
+
4532
+ DematerializeObserver . prototype . next = function ( x ) { x . accept ( this . _o ) ; } ;
4533
+ DematerializeObserver . prototype . error = function ( e ) { this . _o . onError ( e ) ; } ;
4534
+ DematerializeObserver . prototype . completed = function ( ) { this . _o . onCompleted ( ) ; } ;
4535
+
4536
+ return DematerializeObserver ;
4537
+ } ( AbstractObserver ) ) ;
4538
+
4510
4539
/**
4511
4540
* Dematerializes the explicit notification values of an observable sequence as implicit notifications.
4512
4541
* @returns {Observable } An observable sequence exhibiting the behavior corresponding to the source sequence's notification values.
4513
4542
*/
4514
4543
observableProto . dematerialize = function ( ) {
4515
- var source = this ;
4516
- return new AnonymousObservable ( function ( o ) {
4517
- return source . subscribe ( function ( x ) { return x . accept ( o ) ; } , function ( e ) { o . onError ( e ) ; } , function ( ) { o . onCompleted ( ) ; } ) ;
4518
- } , this ) ;
4544
+ return new DematerializeObservable ( this ) ;
4519
4545
} ;
4520
4546
4521
4547
var DistinctUntilChangedObservable = ( function ( __super__ ) {
@@ -4741,23 +4767,41 @@ observableProto.zipIterable = function () {
4741
4767
return new IgnoreElementsObservable ( this ) ;
4742
4768
} ;
4743
4769
4770
+ var MaterializeObservable = ( function ( __super__ ) {
4771
+ inherits ( MaterializeObservable , __super__ ) ;
4772
+ function MaterializeObservable ( source , fn ) {
4773
+ this . source = source ;
4774
+ __super__ . call ( this ) ;
4775
+ }
4776
+
4777
+ MaterializeObservable . prototype . subscribeCore = function ( o ) {
4778
+ return this . source . subscribe ( new MaterializeObserver ( o ) ) ;
4779
+ } ;
4780
+
4781
+ return MaterializeObservable ;
4782
+ } ( ObservableBase ) ) ;
4783
+
4784
+ var MaterializeObserver = ( function ( __super__ ) {
4785
+ inherits ( MaterializeObserver , __super__ ) ;
4786
+
4787
+ function MaterializeObserver ( o ) {
4788
+ this . _o = o ;
4789
+ __super__ . call ( this ) ;
4790
+ }
4791
+
4792
+ MaterializeObserver . prototype . next = function ( x ) { this . _o . onNext ( notificationCreateOnNext ( x ) ) } ;
4793
+ MaterializeObserver . prototype . error = function ( e ) { this . _o . onNext ( notificationCreateOnError ( e ) ) ; this . _o . onCompleted ( ) ; } ;
4794
+ MaterializeObserver . prototype . completed = function ( ) { this . _o . onNext ( notificationCreateOnCompleted ( ) ) ; this . _o . onCompleted ( ) ; } ;
4795
+
4796
+ return MaterializeObserver ;
4797
+ } ( AbstractObserver ) ) ;
4798
+
4744
4799
/**
4745
4800
* Materializes the implicit notifications of an observable sequence as explicit notification values.
4746
4801
* @returns {Observable } An observable sequence containing the materialized notification values from the source sequence.
4747
4802
*/
4748
4803
observableProto . materialize = function ( ) {
4749
- var source = this ;
4750
- return new AnonymousObservable ( function ( observer ) {
4751
- return source . subscribe ( function ( value ) {
4752
- observer . onNext ( notificationCreateOnNext ( value ) ) ;
4753
- } , function ( e ) {
4754
- observer . onNext ( notificationCreateOnError ( e ) ) ;
4755
- observer . onCompleted ( ) ;
4756
- } , function ( ) {
4757
- observer . onNext ( notificationCreateOnCompleted ( ) ) ;
4758
- observer . onCompleted ( ) ;
4759
- } ) ;
4760
- } , source ) ;
4804
+ return new MaterializeObservable ( this ) ;
4761
4805
} ;
4762
4806
4763
4807
/**
@@ -5783,10 +5827,6 @@ Rx.Observable.prototype.flatMapLatest = function(selector, resultSelector, thisA
5783
5827
return ExtremaByObserver ;
5784
5828
} ( AbstractObserver ) ) ;
5785
5829
5786
- function extremaBy ( source , keySelector , comparer ) {
5787
- return new ExtremaByObservable ( source , keySelector , comparer ) ;
5788
- }
5789
-
5790
5830
function firstOnly ( x ) {
5791
5831
if ( x . length === 0 ) { throw new EmptyError ( ) ; }
5792
5832
return x [ 0 ] ;
@@ -6136,7 +6176,7 @@ Rx.Observable.prototype.flatMapLatest = function(selector, resultSelector, thisA
6136
6176
*/
6137
6177
observableProto . minBy = function ( keySelector , comparer ) {
6138
6178
comparer || ( comparer = defaultSubComparer ) ;
6139
- return extremaBy ( this , keySelector , function ( x , y ) { return comparer ( x , y ) * - 1 ; } ) ;
6179
+ return new ExtremaByObservable ( this , keySelector , function ( x , y ) { return comparer ( x , y ) * - 1 ; } ) ;
6140
6180
} ;
6141
6181
6142
6182
/**
@@ -6162,7 +6202,7 @@ Rx.Observable.prototype.flatMapLatest = function(selector, resultSelector, thisA
6162
6202
*/
6163
6203
observableProto . maxBy = function ( keySelector , comparer ) {
6164
6204
comparer || ( comparer = defaultSubComparer ) ;
6165
- return extremaBy ( this , keySelector , comparer ) ;
6205
+ return new ExtremaByObservable ( this , keySelector , comparer ) ;
6166
6206
} ;
6167
6207
6168
6208
/**
@@ -6416,6 +6456,21 @@ Rx.Observable.prototype.flatMapLatest = function(selector, resultSelector, thisA
6416
6456
} , source ) ;
6417
6457
} ;
6418
6458
6459
+ var FirstObservable = ( function ( __super__ ) {
6460
+ inherits ( FirstObservable , __super__ ) ;
6461
+ function FirstObservable ( source , obj ) {
6462
+ this . source = source ;
6463
+ this . _obj = obj ;
6464
+ __super__ . call ( this ) ;
6465
+ }
6466
+
6467
+ FirstObservable . prototype . subscribeCore = function ( o ) {
6468
+ return this . source . subscribe ( new FirstObserver ( o , this . _obj , this . source ) ) ;
6469
+ } ;
6470
+
6471
+ return FirstObservable ;
6472
+ } ( ObservableBase ) ) ;
6473
+
6419
6474
var FirstObserver = ( function ( __super__ ) {
6420
6475
inherits ( FirstObserver , __super__ ) ;
6421
6476
function FirstObserver ( o , obj , s ) {
@@ -6471,11 +6526,24 @@ Rx.Observable.prototype.flatMapLatest = function(selector, resultSelector, thisA
6471
6526
var fn = obj . predicate ;
6472
6527
obj . predicate = bindCallback ( fn , obj . thisArg , 3 ) ;
6473
6528
}
6474
- return new AnonymousObservable ( function ( o ) {
6475
- return source . subscribe ( new FirstObserver ( o , obj , source ) ) ;
6476
- } , source ) ;
6529
+ return new FirstObservable ( this , obj ) ;
6477
6530
} ;
6478
6531
6532
+ var LastObservable = ( function ( __super__ ) {
6533
+ inherits ( LastObservable , __super__ ) ;
6534
+ function LastObservable ( source , obj ) {
6535
+ this . source = source ;
6536
+ this . _obj = obj ;
6537
+ __super__ . call ( this ) ;
6538
+ }
6539
+
6540
+ LastObservable . prototype . subscribeCore = function ( o ) {
6541
+ return this . source . subscribe ( new LastObserver ( o , this . _obj , this . source ) ) ;
6542
+ } ;
6543
+
6544
+ return LastObservable ;
6545
+ } ( ObservableBase ) ) ;
6546
+
6479
6547
var LastObserver = ( function ( __super__ ) {
6480
6548
inherits ( LastObserver , __super__ ) ;
6481
6549
function LastObserver ( o , obj , s ) {
@@ -6538,9 +6606,7 @@ Rx.Observable.prototype.flatMapLatest = function(selector, resultSelector, thisA
6538
6606
var fn = obj . predicate ;
6539
6607
obj . predicate = bindCallback ( fn , obj . thisArg , 3 ) ;
6540
6608
}
6541
- return new AnonymousObservable ( function ( o ) {
6542
- return source . subscribe ( new LastObserver ( o , obj , source ) ) ;
6543
- } , source ) ;
6609
+ return new LastObservable ( this , obj ) ;
6544
6610
} ;
6545
6611
6546
6612
var FindValueObserver = ( function ( __super__ ) {
0 commit comments