1
1
/** @module path */ /** for typedoc */
2
- /// <reference path='../../typings/angularjs/angular.d.ts' />
3
2
import { IInjectable , find , filter , map , tail , defaults , extend , pick , omit } from "../common/common" ;
4
3
import { prop , propEq } from "../common/hof" ;
5
4
import { isString , isObject } from "../common/predicates" ;
6
5
import { trace } from "../common/trace" ;
7
6
import { services } from "../common/coreservices" ;
8
- import { IPromise } from "angular" ;
9
7
import { Resolvables , ResolvePolicy , IOptions1 } from "./interface" ;
10
8
11
9
import { Node } from "../path/module" ;
@@ -17,7 +15,7 @@ import {mergeR} from "../common/common";
17
15
let defaultResolvePolicy = ResolvePolicy [ ResolvePolicy . LAZY ] ;
18
16
19
17
interface IPolicies { [ key : string ] : string ; }
20
- interface IPromises { [ key : string ] : IPromise < any > ; }
18
+ interface Promises { [ key : string ] : Promise < any > ; }
21
19
22
20
export class ResolveContext {
23
21
@@ -93,7 +91,7 @@ export class ResolveContext {
93
91
}
94
92
95
93
// Returns a promise for an array of resolved path Element promises
96
- resolvePath ( options : IOptions1 = { } ) : IPromise < any > {
94
+ resolvePath ( options : IOptions1 = { } ) : Promise < any > {
97
95
trace . traceResolvePath ( this . _path , options ) ;
98
96
const promiseForNode = ( node : Node ) => this . resolvePathElement ( node . state , options ) ;
99
97
return services . $q . all ( < any > map ( this . _path , promiseForNode ) ) . then ( all => all . reduce ( mergeR , { } ) ) ;
@@ -103,7 +101,7 @@ export class ResolveContext {
103
101
// options.resolvePolicy: only return promises for those Resolvables which are at
104
102
// the specified policy, or above. i.e., options.resolvePolicy === 'lazy' will
105
103
// resolve both 'lazy' and 'eager' resolves.
106
- resolvePathElement ( state : State , options : IOptions1 = { } ) : IPromise < any > {
104
+ resolvePathElement ( state : State , options : IOptions1 = { } ) : Promise < any > {
107
105
// The caller can request the path be resolved for a given policy and "below"
108
106
let policy : string = options && options . resolvePolicy ;
109
107
let policyOrdinal : number = ResolvePolicy [ policy || defaultResolvePolicy ] ;
@@ -114,7 +112,7 @@ export class ResolveContext {
114
112
let matchingResolves = filter ( resolvables , matchesRequestedPolicy ) ;
115
113
116
114
const getResolvePromise = ( resolvable : Resolvable ) => resolvable . get ( this . isolateRootTo ( state ) , options ) ;
117
- let resolvablePromises : IPromises = < any > map ( matchingResolves , getResolvePromise ) ;
115
+ let resolvablePromises : Promises = < any > map ( matchingResolves , getResolvePromise ) ;
118
116
119
117
trace . traceResolvePathElement ( this , matchingResolves , options ) ;
120
118
@@ -135,11 +133,11 @@ export class ResolveContext {
135
133
* @param locals: are the angular $injector-style locals to inject
136
134
* @param options: options (TODO: document)
137
135
*/
138
- invokeLater ( fn : IInjectable , locals : any = { } , options : IOptions1 = { } ) : IPromise < any > {
136
+ invokeLater ( fn : IInjectable , locals : any = { } , options : IOptions1 = { } ) : Promise < any > {
139
137
let resolvables = this . getResolvablesForFn ( fn ) ;
140
138
trace . tracePathElementInvoke ( tail ( this . _path ) , fn , Object . keys ( resolvables ) , extend ( { when : "Later" } , options ) ) ;
141
139
const getPromise = ( resolvable : Resolvable ) => resolvable . get ( this , options ) ;
142
- let promises : IPromises = < any > map ( resolvables , getPromise ) ;
140
+ let promises : Promises = < any > map ( resolvables , getPromise ) ;
143
141
144
142
return services . $q . all ( promises ) . then ( ( ) => {
145
143
try {
0 commit comments