File tree Expand file tree Collapse file tree 3 files changed +9
-9
lines changed Expand file tree Collapse file tree 3 files changed +9
-9
lines changed Original file line number Diff line number Diff line change @@ -498,11 +498,11 @@ export class ContainerInstance {
498
498
499
499
if ( value instanceof AsyncInitializedService || service . asyncInitialization ) {
500
500
return new Promise ( ( resolve ) => {
501
- if ( ! ( value . _initialized instanceof Promise ) && service . asyncInitialization ) {
501
+ if ( ! ( value . initialized instanceof Promise ) && service . asyncInitialization ) {
502
502
throw new MissingInitializedPromiseError ( service . value ) ;
503
503
}
504
-
505
- value . _initialized . then ( ( ) => resolve ( value ) ) ;
504
+
505
+ value . initialized . then ( ( ) => resolve ( value ) ) ;
506
506
} ) ;
507
507
}
508
508
return Promise . resolve ( value ) ;
Original file line number Diff line number Diff line change @@ -6,11 +6,11 @@ export class MissingInitializedPromiseError extends Error {
6
6
7
7
constructor ( value : any ) {
8
8
super (
9
- ( value . _initialized
10
- ? `asyncInitialization: true was used, but ${ value . name } #_initialized is not a Promise. `
11
- : `asyncInitialization: true was used, but ${ value . name } #_initialized is undefined. ` ) +
9
+ ( value . initialized
10
+ ? `asyncInitialization: true was used, but ${ value . name } #initialized is not a Promise. `
11
+ : `asyncInitialization: true was used, but ${ value . name } #initialized is undefined. ` ) +
12
12
`You will need to either extend the abstract AsyncInitializedService class, or assign ` +
13
- `${ value . name } #_initialized to a Promise in your class' constructor that resolves when all required ` +
13
+ `${ value . name } #initialized to a Promise in your class' constructor that resolves when all required ` +
14
14
`initialization is complete.`
15
15
) ;
16
16
Object . setPrototypeOf ( this , MissingInitializedPromiseError . prototype ) ;
Original file line number Diff line number Diff line change 2
2
* Extend when declaring a service with asyncInitialization: true flag.
3
3
*/
4
4
export abstract class AsyncInitializedService {
5
- public _initialized : Promise < any > ;
5
+ public initialized : Promise < any > ;
6
6
7
7
constructor ( ) {
8
- this . _initialized = this . initialize ( ) ;
8
+ this . initialized = this . initialize ( ) ;
9
9
}
10
10
11
11
protected abstract initialize ( ) : Promise < any > ;
You can’t perform that action at this time.
0 commit comments