Skip to content

Commit

Permalink
added type definitions to releases
Browse files Browse the repository at this point in the history
  • Loading branch information
remojansen committed Apr 17, 2015
1 parent 94d182d commit e3cdb4e
Show file tree
Hide file tree
Showing 6 changed files with 58 additions and 6 deletions.
2 changes: 1 addition & 1 deletion dist/inversify.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions dist/typings/interfaces.d.ts
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;
}
37 changes: 37 additions & 0 deletions dist/typings/inversify.d.ts
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;
};
6 changes: 3 additions & 3 deletions source/inversify.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@

// The Inversify main file, the library entry point.

// ## [Kernel](http://inversify.io/documentation/kernel.html)
// ##### [Kernel](http://inversify.io/documentation/kernel.html)
import Kernel = require("./kernel");

// ## [TypeBinding ](http://inversify.io/documentation/type_binding.html)
// ##### [TypeBinding ](http://inversify.io/documentation/type_binding.html)
import TypeBinding = require("./type_binding");

// ## [TypeBindingScopeEnum](http://inversify.io/documentation/type_binding_scope.html)
// ##### [TypeBindingScopeEnum](http://inversify.io/documentation/type_binding_scope.html)
import TypeBindingScopeEnum = require("./type_binding_scope");

var inversify = {
Expand Down
5 changes: 3 additions & 2 deletions source/kernel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
// to be told which implementation type (classes) to associate
// with each service type (interfaces).

// ##### [TypeBindingScopeEnum](http://inversify.io/documentation/type_binding_scope.html)
import TypeBindingScopeEnum = require("./type_binding_scope");

class Kernel implements KernelInterface {
Expand Down Expand Up @@ -137,8 +138,8 @@ class Kernel implements KernelInterface {
}
}

// Use of .apply() with 'new' operator. Can call any constructor (except native
// constructors that behave differently when called as functions, like String,
// Use of .apply() with 'new' operator. Can call any constructor (except native
// constructors that behave differently when called as functions, like String,
// Number, Date, etc.) with an array of arguments
private _construct<TImplementationType>(
constr : { new(): TImplementationType ;}, args : Object[]) : TImplementationType {
Expand Down
1 change: 1 addition & 0 deletions source/type_binding.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
// (an interface), and an implementation type to be used to satisfy such
// a service requirement.

// ##### [TypeBindingScopeEnum](http://inversify.io/documentation/type_binding_scope.html)
import TypeBindingScopeEnum = require("./type_binding_scope");

class TypeBinding<TServiceType> implements TypeBindingInterface<TServiceType> {
Expand Down

0 comments on commit e3cdb4e

Please sign in to comment.