Closed doriansmiley closed 6 years ago
The new method signature would be:
public mapObject(key:any, constructor:Function, useSingleton:boolean=false, params:Array<any>):void{
We then could refactor inject pass the params in the call to the constructor function as follows:
inject
return new (map.constructor as FunctionConstructor).apply(this, params);
I'm not sure if this will mess with scoping as this would refer to the context. I think a better approach would be something like
this
return new Function.prototype.bind.apply(map.constructor, params);
done in 1.0.12
The new method signature would be:
We then could refactor
inject
pass the params in the call to the constructor function as follows:I'm not sure if this will mess with scoping as
this
would refer to the context. I think a better approach would be something like