@contember/dic
Advanced tools
Comparing version 1.3.0-alpha.1 to 1.3.0-alpha.2
@@ -75,3 +75,5 @@ "use strict"; | ||
if (this.level === 0) { | ||
this.setups.forEach(it => it()); | ||
const setups = this.setups; | ||
this.setups = []; | ||
setups.forEach(it => it()); | ||
} | ||
@@ -90,7 +92,9 @@ return service; | ||
} | ||
this.setups.push(() => { | ||
for (const setup of definition.setup) { | ||
setup(service, accessors); | ||
} | ||
}); | ||
if (definition.setup.length > 0) { | ||
this.setups.push(() => { | ||
for (const setup of definition.setup) { | ||
setup(service, accessors); | ||
} | ||
}); | ||
} | ||
const service = definition.factory(accessors); | ||
@@ -97,0 +101,0 @@ return service; |
{ | ||
"name": "@contember/dic", | ||
"version": "1.3.0-alpha.1", | ||
"version": "1.3.0-alpha.2", | ||
"license": "Apache-2.0", | ||
@@ -5,0 +5,0 @@ "main": "dist/src/index.js", |
@@ -33,3 +33,3 @@ export type ServiceName = string | ||
name: N extends keyof M ? N : 'Service with this name does not exist', | ||
factory: ServiceFactory<M & {inner: T}, T> | ServiceDefinition<M, T>, | ||
factory: ServiceFactory<M & { inner: T }, T> | ServiceDefinition<M, T>, | ||
): Builder<M> { | ||
@@ -106,3 +106,5 @@ const currentFactory = this.factories[name] | ||
if (this.level === 0) { | ||
this.setups.forEach(it => it()) | ||
const setups = this.setups | ||
this.setups = [] | ||
setups.forEach(it => it()) | ||
} | ||
@@ -125,7 +127,9 @@ return service | ||
} | ||
this.setups.push(() => { | ||
for (const setup of definition.setup) { | ||
setup(service, accessors) | ||
} | ||
}) | ||
if (definition.setup.length > 0) { | ||
this.setups.push(() => { | ||
for (const setup of definition.setup) { | ||
setup(service, accessors) | ||
} | ||
}) | ||
} | ||
const service = definition.factory(accessors) | ||
@@ -132,0 +136,0 @@ return service |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
47941
317