rage-framework
Version:
## How to Install *server-side* ```bash npm install @rage-framework/server ```
30 lines • 1.15 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.constructorWatcherService = exports.ConstructorWatcherService = void 0;
class ConstructorWatcherService {
constructor() {
this._constructors = new Map();
}
getConstructor(name) {
return this._constructors.get(name);
}
getByClass(currentClass) {
return this._constructors.get(currentClass.name)['value'];
}
createConstructor(name, value) {
if (this._constructors.has(name)) {
return this.getConstructor(name);
}
this._constructors.set(name, value);
return this.getConstructor(name);
}
triggerOnInit(currentClass) {
const currentConstructor = this._constructors.get(currentClass.name);
if (currentConstructor['value'] && currentConstructor['value'].onInit) {
currentConstructor['value'].onInit.bind(currentConstructor['value'])();
}
}
}
exports.ConstructorWatcherService = ConstructorWatcherService;
exports.constructorWatcherService = new ConstructorWatcherService();
//# sourceMappingURL=constructor-watcher.service.js.map