Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | 7x 7x 35x 2x 35x 35x 35x 2x 2x 2x 7x | import { Service } from '../../container/decorators/Service';
export class ConstructorWatcherService {
_constructors: Map<string, Function> = new Map();
getConstructor(name: string) {
return this._constructors.get(name);
}
getByClass<T>(currentClass: Function): T {
return this._constructors.get(currentClass.name)['value'];
}
createConstructor(name: string, value) {
Iif (this._constructors.has(name)) {
return this.getConstructor(name);
}
this._constructors.set(name, value);
return this.getConstructor(name);
}
triggerOnInit(currentClass: Function) {
const currentConstructor = this._constructors.get(currentClass.name);
Eif (currentConstructor['value'] && currentConstructor['value'].OnInit) {
currentConstructor['value'].OnInit.bind(currentConstructor['value'])();
}
}
}
export const constructorWatcherService = new ConstructorWatcherService(); |