-
Notifications
You must be signed in to change notification settings - Fork 712
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
94d182d
commit e3cdb4e
Showing
6 changed files
with
58 additions
and
6 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters