@dits/dits
Advanced tools
Comparing version 0.1.7 to 0.1.8
import Container from "./container"; | ||
import SmartProxy from "./proxy"; | ||
export interface Constructor<E> { | ||
export declare type Constructor<E> = { | ||
new (...args: any[]): E; | ||
} | ||
} | (Function & { | ||
prototype: E; | ||
}); | ||
export interface ComponentDeclaration<T> { | ||
@@ -7,0 +9,0 @@ instance?: T; |
@@ -113,3 +113,4 @@ "use strict"; | ||
try { | ||
cd.instance = new cd.type(...cd.dependencies); | ||
const type = cd.type; | ||
cd.instance = new type(...cd.dependencies); | ||
} | ||
@@ -116,0 +117,0 @@ catch (err) { |
import { ComponentRegistry, ComponentDeclaration } from "./components"; | ||
import { HandlerRegistry } from "../dispatch/handlers"; | ||
import { DispatchEvent, EventConstructor, HandlerDeclaration } from "../dispatch/dispatch"; | ||
declare type ConstructorOrAbstractConstructor<T> = { | ||
new (...args: any[]): T; | ||
} | (Function & { | ||
prototype: T; | ||
}); | ||
export default class Container { | ||
@@ -13,14 +18,6 @@ name: string; | ||
static fromZone(): Container; | ||
get<T, C extends { | ||
new (...args: any[]): T; | ||
}>(key: C): T | undefined; | ||
getOrThrow<T, C extends { | ||
new (...args: any[]): T; | ||
}>(key: C, errMessage?: string): T; | ||
provide<T>(key: { | ||
new (...args: any[]): unknown; | ||
}, instance: T, override?: boolean): this; | ||
declare<T>(key: { | ||
new (...args: any[]): unknown; | ||
}, declaration: ComponentDeclaration<T>, override?: boolean): this; | ||
get<T, C extends ConstructorOrAbstractConstructor<T>>(key: C): T | undefined; | ||
getOrThrow<T, C extends ConstructorOrAbstractConstructor<T>>(key: C, errMessage?: string): T; | ||
provide<T>(key: ConstructorOrAbstractConstructor<T>, instance: T, override?: boolean): this; | ||
declare<T>(key: ConstructorOrAbstractConstructor<T>, declaration: ComponentDeclaration<T>, override?: boolean): this; | ||
handler<E extends DispatchEvent>(event: EventConstructor<E>, declaration: HandlerDeclaration<E>): this; | ||
@@ -30,5 +27,6 @@ reset(parent?: Container | Boolean): void; | ||
private getAncestry; | ||
unwrap(): Map<new (...args: any[]) => unknown, unknown>; | ||
unwrap(): Map<ConstructorOrAbstractConstructor<any>, unknown>; | ||
createChild(name: string): Container; | ||
} | ||
export {}; | ||
//# sourceMappingURL=container.d.ts.map |
@@ -8,6 +8,2 @@ "use strict"; | ||
const log = new tslog_1.Logger({ name: __filename }); | ||
// /** | ||
// * Keeps track of classes and their instances | ||
// * TODO: make this zone specific? | ||
// */ | ||
class Container { | ||
@@ -14,0 +10,0 @@ name; |
{ | ||
"name": "@dits/dits", | ||
"version": "0.1.7", | ||
"version": "0.1.8", | ||
"main": "lib/index.js", | ||
@@ -5,0 +5,0 @@ "types": "lib/index.d.ts", |
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
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
108335
1533