added inversify type definitions

This commit is contained in:
remojansen
2015-04-18 01:00:25 +01:00
parent 52fa2b9ce3
commit 20d6106860
2 changed files with 50 additions and 0 deletions
+13
View File
@@ -0,0 +1,13 @@
interface TypeBindingInterface<TServiceType> {
runtimeIdentifier : string;
implementationType : { new(): TServiceType ;};
cache : TServiceType;
scope : number; // TypeBindingScopeEnum
}
interface KernelInterface {
bind(typeBinding : TypeBindingInterface<any>) : void;
unbind(runtimeIdentifier : string) : void;
unbindAll() : void;
resolve<TImplementationType>(runtimeIdentifier : string) : TImplementationType;
}
+37
View File
@@ -0,0 +1,37 @@
/// <reference path="interfaces.d.ts" />
declare enum TypeBindingScopeEnum {
Transient = 0,
Singleton = 1,
}
declare class TypeBinding<TServiceType> implements TypeBindingInterface<TServiceType> {
runtimeIdentifier: string;
implementationType: {
new (): TServiceType;
};
cache: TServiceType;
scope: TypeBindingScopeEnum;
constructor(runtimeIdentifier: string, implementationType: {
new (...args: any[]): TServiceType;
}, scopeType?: TypeBindingScopeEnum);
}
declare class Kernel implements KernelInterface {
private _bindings;
bind(typeBinding: TypeBindingInterface<any>): void;
unbind(runtimeIdentifier: string): void;
unbindAll(): void;
resolve<TImplementationType>(runtimeIdentifier: string): TImplementationType;
private _validateBinding(typeBinding);
private _getConstructorArguments(func);
private _injectDependencies<TImplementationType>(func);
private _construct<TImplementationType>(constr, args);
constructor();
}
declare var inversify: {
Kernel: typeof Kernel;
TypeBindingScopeEnum: typeof TypeBindingScopeEnum;
TypeBinding: typeof TypeBinding;
};