@spinajs/di
Advanced tools
Comparing version 1.2.20 to 1.2.26
@@ -113,6 +113,10 @@ "use strict"; | ||
const emit = (target) => { | ||
// firs event to emit that particular type was resolved | ||
this.emit(`di.resolved.${(0, helpers_1.getTypeName)(target)}`, this, target); | ||
// emit that source type was resolved | ||
this.emit(`di.resolved.${sourceName}`, this, target); | ||
// do not emit when we alrady created and cached value | ||
// ( resolve happends only once eg. for singletons) | ||
if (!this.Cache.has((0, helpers_1.getTypeName)(target))) { | ||
// firs event to emit that particular type was resolved | ||
this.emit(`di.resolved.${(0, helpers_1.getTypeName)(target)}`, this, target); | ||
// emit that source type was resolved | ||
this.emit(`di.resolved.${sourceName}`, this, target); | ||
} | ||
}; | ||
@@ -141,4 +145,4 @@ if (options === true || check === true) { | ||
value.forEach((v) => { | ||
emit(v); | ||
setCache(v); | ||
emit(v); | ||
}); | ||
@@ -150,4 +154,4 @@ return value; | ||
resolved.forEach((v) => { | ||
emit(v); | ||
setCache(v); | ||
emit(v); | ||
}); | ||
@@ -175,9 +179,9 @@ return resolved; | ||
return rValue.then((v) => { | ||
emit(v); | ||
setCache(v); | ||
emit(v); | ||
return v; | ||
}); | ||
} | ||
emit(rValue); | ||
setCache(rValue); | ||
emit(rValue); | ||
return rValue; | ||
@@ -184,0 +188,0 @@ } |
@@ -132,3 +132,3 @@ "use strict"; | ||
autoinjectKey: propertyKey, | ||
inject: isArray ? Array.ofType(injectType) : type, | ||
inject: isArray ? Array.ofType(injectType) : injectType !== null && injectType !== void 0 ? injectType : type, | ||
}); | ||
@@ -135,0 +135,0 @@ }); |
@@ -35,3 +35,3 @@ "use strict"; | ||
function isPromise(value) { | ||
return Boolean(value && typeof value.then === 'function'); | ||
return value instanceof Promise; | ||
} | ||
@@ -38,0 +38,0 @@ exports.isPromise = isPromise; |
{ | ||
"name": "@spinajs/di", | ||
"version": "1.2.20", | ||
"version": "1.2.26", | ||
"description": "lightweight di container ", | ||
@@ -46,3 +46,3 @@ "main": "lib/index.js", | ||
}, | ||
"gitHead": "bbed041879adfd9d6a502aa27891a3682e68c20c" | ||
"gitHead": "db0a4879ea356c677f78938201ddf93e032e1e63" | ||
} |
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
88229
1598