This repository was archived by the owner on Feb 17, 2024. It is now read-only.
File tree 3 files changed +72
-1
lines changed
3 files changed +72
-1
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ import {bootstrap} from 'angular2/angular2';
7
7
// include any injectables
8
8
import { routerInjectables } from 'angular2/router' ;
9
9
import { shadowDomInjectables } from '../common/shadowDomInjectables' ;
10
+ import { rxPipeRegistry } from '../common/rxPipes' ;
10
11
11
12
// Our injectables Services
12
13
// import {appServicesInjectables} from './services/services';
@@ -22,5 +23,6 @@ bootstrap(App, [
22
23
// shadowDomInjectables,
23
24
// our servies
24
25
// appServicesInjectables,
25
- modelInjectables
26
+ modelInjectables ,
27
+ rxPipeRegistry
26
28
] ) ;
Original file line number Diff line number Diff line change
1
+ import { PipeFactory } from 'angular2/src/change_detection/pipes/pipe' ;
2
+ import { async } from 'angular2/src/change_detection/change_detection' ;
3
+ import { Pipe , PipeRegistry , defaultPipes } from 'angular2/change_detection' ;
4
+ import { bind } from 'angular2/di' ;
5
+ import { ObservablePipe } from 'angular2/pipes' ;
6
+ import * as Rx from 'rx' ;
7
+
8
+ export function isObservable ( obs ) {
9
+ return obs && obs . subscribe ;
10
+ }
11
+
12
+ export class RxPipe extends ObservablePipe {
13
+ _subscription : any ;
14
+ _observable : any ;
15
+ constructor ( ref ) { super ( ref ) ; }
16
+ supports ( obs ) { return isObservable ( obs ) ; }
17
+ _subscribe ( obs ) {
18
+ this . _observable = obs ;
19
+ this . _subscription = obs . subscribe (
20
+ value => this . _updateLatestValue ( value ) ,
21
+ e => { throw e ; }
22
+ ) ;
23
+ }
24
+
25
+ }
26
+
27
+ export class RxPipeFactory extends PipeFactory {
28
+ constructor ( ) { super ( ) ; }
29
+
30
+ supports ( obs ) { return isObservable ( obs ) ; }
31
+
32
+ create ( cdRef ) : Pipe { return new RxPipe ( cdRef ) ; }
33
+ }
34
+
35
+ export var rxAsync = [ new RxPipeFactory ( ) ] . concat ( async ) ;
36
+
37
+ export var rxPipes = Object . assign ( { } , defaultPipes , {
38
+ 'async' : rxAsync
39
+ } ) ;
40
+
41
+ export var rxPipeRegistry = [
42
+ bind ( PipeRegistry ) . toValue ( new PipeRegistry ( rxPipes ) )
43
+ ] ;
Original file line number Diff line number Diff line change @@ -5,6 +5,32 @@ declare var global: any;
5
5
declare var zone : any ;
6
6
declare var Zone : any ;
7
7
8
+ declare module "angular2/src/change_detection/pipes/pipe" {
9
+ class PipeFactory { }
10
+ }
11
+
12
+ declare module "angular2/src/change_detection/change_detection" {
13
+ var async : any ;
14
+ }
15
+
16
+ declare module "angular2/change_detection" {
17
+ class Pipe { }
18
+ class PipeRegistry {
19
+ constructor ( pipes : any )
20
+ }
21
+ var defaultPipes : any ;
22
+ }
23
+
24
+ declare module "angular2/pipes" {
25
+ class ObservablePipe {
26
+ constructor ( ref : any )
27
+ _subscription : any ;
28
+ _observable : any ;
29
+ _updateLatestValue ( value : any ) : any ;
30
+ _subscribe ( obs : any ) : any ;
31
+ }
32
+ }
33
+
8
34
declare module 'angular2/src/services/url_resolver' {
9
35
class UrlResolver { }
10
36
}
You can’t perform that action at this time.
0 commit comments