ts-ioc-container 37.2.3 → 37.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -102,8 +102,16 @@ class Container {
|
|
|
102
102
|
getScopes() {
|
|
103
103
|
return [...this.scopes];
|
|
104
104
|
}
|
|
105
|
-
getInstances() {
|
|
106
|
-
|
|
105
|
+
getInstances({ cascade = true } = {}) {
|
|
106
|
+
const result = [...this.instances];
|
|
107
|
+
if (cascade) {
|
|
108
|
+
for (const scope of this.scopes) {
|
|
109
|
+
for (const instance of scope.getInstances({ cascade })) {
|
|
110
|
+
result.push(instance);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
return result;
|
|
107
115
|
}
|
|
108
116
|
hasTag(tag) {
|
|
109
117
|
return this.tags.has(tag);
|
|
@@ -99,8 +99,16 @@ export class Container {
|
|
|
99
99
|
getScopes() {
|
|
100
100
|
return [...this.scopes];
|
|
101
101
|
}
|
|
102
|
-
getInstances() {
|
|
103
|
-
|
|
102
|
+
getInstances({ cascade = true } = {}) {
|
|
103
|
+
const result = [...this.instances];
|
|
104
|
+
if (cascade) {
|
|
105
|
+
for (const scope of this.scopes) {
|
|
106
|
+
for (const instance of scope.getInstances({ cascade })) {
|
|
107
|
+
result.push(instance);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
return result;
|
|
104
112
|
}
|
|
105
113
|
hasTag(tag) {
|
|
106
114
|
return this.tags.has(tag);
|
package/package.json
CHANGED
|
@@ -33,7 +33,9 @@ export declare class Container implements IContainer {
|
|
|
33
33
|
resolveOneByAlias<T>(predicate: AliasPredicate, { args, child, lazy }?: ResolveOptions): [DependencyKey, T];
|
|
34
34
|
getParent(): IContainer;
|
|
35
35
|
getScopes(): IContainer[];
|
|
36
|
-
getInstances(
|
|
36
|
+
getInstances({ cascade }?: {
|
|
37
|
+
cascade?: boolean;
|
|
38
|
+
}): Instance[];
|
|
37
39
|
hasTag(tag: Tag): boolean;
|
|
38
40
|
/**
|
|
39
41
|
* @private
|
|
@@ -43,7 +43,9 @@ export interface IContainer extends Resolvable, Tagged {
|
|
|
43
43
|
hasProvider(key: DependencyKey): boolean;
|
|
44
44
|
getParent(): IContainer | undefined;
|
|
45
45
|
getScopes(): IContainer[];
|
|
46
|
-
getInstances(
|
|
46
|
+
getInstances(options?: {
|
|
47
|
+
cascade?: boolean;
|
|
48
|
+
}): Instance[];
|
|
47
49
|
resolveManyByAlias(predicate: AliasPredicate, options?: ResolveOptions, result?: Map<DependencyKey, unknown>): Map<DependencyKey, unknown>;
|
|
48
50
|
resolveOneByAlias<T>(predicate: AliasPredicate, options?: ResolveOptions): [DependencyKey, T];
|
|
49
51
|
detachFromParent(): void;
|