@inversifyjs/container
Version:
InversifyJs container
57 lines • 2.44 kB
JavaScript
import { isPlugin, } from '@inversifyjs/plugin';
import { InversifyContainerError } from '../../error/models/InversifyContainerError.js';
import { InversifyContainerErrorKind } from '../../error/models/InversifyContainerErrorKind.js';
export class PluginManager {
constructor(container, serviceReferenceManager, serviceResolutionManager) {
this.
this.
this.
this.
}
register(container, pluginConstructor) {
const pluginInstance = new pluginConstructor(container, this.
this.
pluginInstance.load(this.
}
if (value[isPlugin] !== true) {
throw new InversifyContainerError(InversifyContainerErrorKind.invalidOperation, 'Invalid plugin. The plugin must extend the Plugin class');
}
}
return {
define: (name,
// eslint-disable-next-line @typescript-eslint/no-explicit-any
method) => {
if (Object.prototype.hasOwnProperty.call(container, name)) {
throw new InversifyContainerError(InversifyContainerErrorKind.invalidOperation, `Container already has a method named "${String(name)}"`);
}
container[name] =
method;
},
onPlan: this.
};
}
const serviceReferenceManager = this.
return {
get activationService() {
return serviceReferenceManager.activationService;
},
get bindingService() {
return serviceReferenceManager.bindingService;
},
get deactivationService() {
return serviceReferenceManager.deactivationService;
},
get planResultCacheService() {
return serviceReferenceManager.planResultCacheService;
},
};
}
}
//# sourceMappingURL=PluginManager.js.map