@@ -20,7 +20,7 @@ export class ContainerInstance {
20
20
* Container instance id.
21
21
*/
22
22
id : any ;
23
-
23
+
24
24
// -------------------------------------------------------------------------
25
25
// Private Properties
26
26
// -------------------------------------------------------------------------
@@ -37,7 +37,7 @@ export class ContainerInstance {
37
37
constructor ( id : any ) {
38
38
this . id = id ;
39
39
}
40
-
40
+
41
41
// -------------------------------------------------------------------------
42
42
// Public Methods
43
43
// -------------------------------------------------------------------------
@@ -270,7 +270,7 @@ export class ContainerInstance {
270
270
}
271
271
272
272
if ( type )
273
- this . applyPropertyHandlers ( type ) ;
273
+ this . applyPropertyHandlers ( type , service . value ) ;
274
274
275
275
return service . value ;
276
276
}
@@ -302,18 +302,13 @@ export class ContainerInstance {
302
302
/**
303
303
* Applies all registered handlers on a given target class.
304
304
*/
305
- private applyPropertyHandlers ( target : Function ) {
305
+ private applyPropertyHandlers ( target : Function , instance : { [ key : string ] : any } ) {
306
306
Container . handlers . forEach ( handler => {
307
- if ( handler . index ) return ;
307
+ if ( typeof handler . index === "number" ) return ;
308
308
if ( handler . object . constructor !== target && ! ( target . prototype instanceof handler . object . constructor ) )
309
309
return ;
310
310
311
- Object . defineProperty ( handler . object , handler . propertyName , {
312
- enumerable : true ,
313
- writable : true ,
314
- configurable : true ,
315
- value : handler . value ( this )
316
- } ) ;
311
+ instance [ handler . propertyName ] = handler . value ( this ) ;
317
312
} ) ;
318
313
}
319
314
0 commit comments