@inversifyjs/core
Version:
InversifyJs core package
20 lines • 1.06 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.getExtendedLifecycle = getExtendedLifecycle;
function getLifecycleSetUnion(extend, baseSet, currentSet) {
if (extend) {
return new Set([...baseSet, ...currentSet]);
}
return currentSet;
}
function getExtendedLifecycle(options, baseTypeClassMetadata, typeMetadata) {
const extendPostConstructMethods = options.lifecycle?.extendPostConstructMethods ?? true;
const extendPreDestroyMethods = options.lifecycle?.extendPreDestroyMethods ?? true;
const preDestroyMethodNames = getLifecycleSetUnion(extendPreDestroyMethods, baseTypeClassMetadata.lifecycle.preDestroyMethodNames, typeMetadata.lifecycle.preDestroyMethodNames);
const postConstructMethodNames = getLifecycleSetUnion(extendPostConstructMethods, baseTypeClassMetadata.lifecycle.postConstructMethodNames, typeMetadata.lifecycle.postConstructMethodNames);
return {
postConstructMethodNames,
preDestroyMethodNames,
};
}
//# sourceMappingURL=getExtendedLifecycle.js.map