You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've got a proposal to include target instance (which I suppose is not possible since there isn't async resolution logic yet) or target Class (Type) name (I mean, TargetClass.constructor.name or even TargetClass.constructor) in factory binder context.
One of the most popular commonly used dependency is Logger, but the logger often include extra params, like Category or Module Name, that describes the place module logs comes from. Conventionally it looks like this:
Container.bind(Logger).factory(context=>{// proposal: 'context.target' here is actual constructor (function) of target classreturnLog.createLogger(context.target.name));}
I've got a proposal to include target instance (which I suppose is not possible since there isn't async resolution logic yet) or target Class (Type) name (I mean,
TargetClass.constructor.name
or evenTargetClass.constructor
) in factory binder context.One of the most popular commonly used dependency is Logger, but the logger often include extra params, like Category or Module Name, that describes the place module logs comes from. Conventionally it looks like this:
So, with IoC I would like to have smth like this:
But currently there is no way to get any suitable target instance info within factory context.
The text was updated successfully, but these errors were encountered: