How to replace XXX so that the replacement will be evaluated for the correspondent class that get imported?e.g. if name is "FooService", then the imported FooService class will be evaluated and used in XXX.
Class FooService:
export class FooService {}
Class BarService:
export class BarService {}
Class Container:
import {FooService} from './FooService'
import {BarService} from './BarService'
export class Container {
constructor() {
this._services = new Map();
}
getServiceByName(name) {
if (!this._services.has(name)) {
// How to replace XXX so that the replacement will
// be evaluated for the correspondent class that get imported?
// e.g. if name is "FooService", then the imported FooService
// class will be evaluated and used in XXX.
this._services.set(name, XXX);
}
return this._service.get(name);
}
}