File tree Expand file tree Collapse file tree 3 files changed +13
-4
lines changed Expand file tree Collapse file tree 3 files changed +13
-4
lines changed Original file line number Diff line number Diff line change 1
1
import { Observable } from '../Observable' ;
2
- import { AsyncSubject } from '../AsyncSubject' ;
3
- import { multicast } from './multicast' ;
4
2
import { ConnectableObservable } from '../observable/ConnectableObservable' ;
5
-
3
+ import { publishLast as higherOrder } from '../operators' ;
6
4
/**
7
5
* @return {ConnectableObservable<T> }
8
6
* @method publishLast
9
7
* @owner Observable
10
8
*/
11
9
export function publishLast < T > ( this : Observable < T > ) : ConnectableObservable < T > {
12
- return multicast . call ( this , new AsyncSubject < T > ( ) ) ;
10
+ //TODO(benlesh): correct type-flow through here.
11
+ return higherOrder ( ) ( this ) as ConnectableObservable < T > ;
13
12
}
Original file line number Diff line number Diff line change @@ -54,6 +54,7 @@ export { partition } from './partition';
54
54
export { pluck } from './pluck' ;
55
55
export { publish } from './publish' ;
56
56
export { publishBehavior } from './publishBehavior' ;
57
+ export { publishLast } from './publishLast' ;
57
58
export { race } from './race' ;
58
59
export { reduce } from './reduce' ;
59
60
export { refCount } from './refCount' ;
Original file line number Diff line number Diff line change
1
+ import { Observable } from '../Observable' ;
2
+ import { AsyncSubject } from '../AsyncSubject' ;
3
+ import { multicast } from './multicast' ;
4
+ import { OperatorFunction } from '../interfaces' ;
5
+
6
+ //TODO(benlesh): specify that the second type is actually a ConnectableObservable
7
+ export function publishLast < T > ( ) : OperatorFunction < T , T > {
8
+ return ( source : Observable < T > ) => multicast ( new AsyncSubject < T > ( ) ) ( source ) ;
9
+ }
You can’t perform that action at this time.
0 commit comments