@artus/injection
Advanced tools
Comparing version 0.4.0 to 0.4.1
@@ -9,3 +9,11 @@ "use strict"; | ||
return (target) => { | ||
(0, util_1.setMetadata)(constant_1.CLASS_CONSTRUCTOR, Object.assign({ id: target, scope: types_1.ScopeEnum.SINGLETON }, options), target); | ||
const md = Object.assign({ id: target, scope: types_1.ScopeEnum.SINGLETON, lazy: false }, options); | ||
(0, util_1.setMetadata)(constant_1.CLASS_CONSTRUCTOR, md, target); | ||
// make all properties lazy | ||
if (md.lazy) { | ||
const props = (0, util_1.recursiveGetMetadata)(constant_1.CLASS_PROPERTY, target); | ||
const handlerProps = (0, util_1.recursiveGetMetadata)(constant_1.INJECT_HANDLER_PROPS, target); | ||
const properties = (props !== null && props !== void 0 ? props : []).concat(handlerProps !== null && handlerProps !== void 0 ? handlerProps : []); | ||
properties.forEach(property => property.handler = constant_1.LAZY_HANDLER); | ||
} | ||
}; | ||
@@ -12,0 +20,0 @@ } |
@@ -20,2 +20,3 @@ export declare type Constructable<T = unknown> = new (...args: any[]) => T; | ||
scope?: ScopeEnum; | ||
lazy?: boolean; | ||
} | ||
@@ -22,0 +23,0 @@ export interface InjectableDefinition<T = unknown> { |
{ | ||
"name": "@artus/injection", | ||
"version": "0.4.0", | ||
"version": "0.4.1", | ||
"description": "A IoC Implemention for Artus.", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
52254
808