awilix
Advanced tools
Comparing version 3.0.0-rc.2 to 3.0.0-rc.3
@@ -22,7 +22,2 @@ "use strict"; | ||
/** | ||
* Scopes symbol. | ||
* @type {Symbol} | ||
*/ | ||
const SCOPES = Symbol('scopes'); | ||
/** | ||
* Creates an Awilix container instance. | ||
@@ -113,3 +108,2 @@ * | ||
[ROLL_UP_REGISTRATIONS]: rollUpRegistrations, | ||
[SCOPES]: [], | ||
get registrations() { | ||
@@ -124,7 +118,2 @@ return rollUpRegistrations(); | ||
container[FAMILY_TREE] = familyTree; | ||
// Add this container to the parent's scopes. | ||
if (parentContainer) { | ||
; | ||
parentContainer[SCOPES].push(container); | ||
} | ||
// We need a reference to the root container, | ||
@@ -339,18 +328,2 @@ // so we can retrieve and store singletons. | ||
function dispose() { | ||
const scopes = getChildScopes(); | ||
return Promise.all(scopes.map(s => s.dispose())).then(() => { | ||
return callDisposersAndClearCache(); | ||
}); | ||
} | ||
/** | ||
* Gets the child scopes for this container. | ||
*/ | ||
function getChildScopes() { | ||
return container[SCOPES]; | ||
} | ||
/** | ||
* Calls the disposers on the cached values, then clears the cache | ||
* for this container. | ||
*/ | ||
function callDisposersAndClearCache() { | ||
const entries = Array.from(container.cache.entries()); | ||
@@ -357,0 +330,0 @@ container.cache.clear(); |
{ | ||
"name": "awilix", | ||
"version": "3.0.0-rc.2", | ||
"version": "3.0.0-rc.3", | ||
"description": "Simple dependency injection container + helper utilities to facilitate wiring of modules", | ||
@@ -5,0 +5,0 @@ "main": "lib/awilix.js", |
@@ -612,5 +612,4 @@ # Awilix | ||
**Important:** the container being disposed will first dispose it's child | ||
containers (the ones created using `createScope()`), before disposing it's own | ||
cache. This also means you can dispose a scope without disposing the parent. | ||
**Important:** the container being disposed **will not dispose its' scopes**. It | ||
only disposes values **in it's own cache**. | ||
@@ -1186,7 +1185,6 @@ ```js | ||
Returns a `Promise` that resolves when all disposers on the container and it's | ||
child-containers (scopes) have resolved. The disposers run **depth-first**, | ||
meaning sub-scopes get disposed before their parents. **Only cached values will | ||
be disposed, meaning they must have a `Lifetime` of `SCOPED` or `SINGLETON`**, | ||
else they are not cached. | ||
Returns a `Promise` that resolves when all disposers of cached resolutions have | ||
resolved. **Only cached values will be disposed, meaning they must have a | ||
`Lifetime` of `SCOPED` or `SINGLETON`**, or else they are not cached by the | ||
container and therefore can't be disposed by it. | ||
@@ -1193,0 +1191,0 @@ This also clears the container's cache. |
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
0
134708
2031
1229