Comparing version 0.0.16 to 0.0.17
11
di.d.ts
@@ -15,2 +15,13 @@ | ||
export class Inject { | ||
constructor(injectableClass: IClassInterface<any>); | ||
} | ||
export class Provide { | ||
constructor(providedClass: IClassInterface<any>); | ||
} | ||
export function annotate<T>(classFunc: IClassInterface<T>, ...dependencies: Inject[]): void; | ||
export function annotate<T>(classFunc: IClassInterface<T>, ...dependencies: Provide[]): void; | ||
} | ||
@@ -17,0 +28,0 @@ |
@@ -0,1 +1,2 @@ | ||
/// <reference path="node_modules/reflect-metadata/reflect-metadata.d.ts"/> | ||
/// <reference path="./di.d.ts"/> | ||
@@ -7,3 +8,4 @@ require('reflect-metadata'); | ||
var dependencies = Reflect.getMetadata("design:paramtypes", classFunc) || []; | ||
di.annotate.apply(di, [classFunc].concat(dependencies.map(function (dep) { return new di.Inject(dep); }))); | ||
var annotateArgs = [classFunc].concat(dependencies.map(function (dep) { return new di.Inject(dep); })); | ||
di.annotate.apply(di, annotateArgs); | ||
} | ||
@@ -10,0 +12,0 @@ exports.Inject = Inject; |
10
index.ts
@@ -0,1 +1,3 @@ | ||
/// <reference path="node_modules/reflect-metadata/reflect-metadata.d.ts"/> | ||
/// <reference path="./di.d.ts"/> | ||
@@ -6,6 +8,3 @@ | ||
declare | ||
var Reflect: any; | ||
export var Injector = di.Injector; | ||
@@ -15,3 +14,4 @@ | ||
const dependencies = Reflect.getMetadata("design:paramtypes", classFunc) || []; | ||
(<any>di).annotate.apply(di, [classFunc].concat(dependencies.map((dep: any) => new (<any>di).Inject(dep)))); | ||
var annotateArgs = [classFunc].concat(dependencies.map((dep: any) => new di.Inject(dep))); | ||
di.annotate.apply(di, annotateArgs); | ||
} | ||
@@ -21,3 +21,3 @@ | ||
return function (classFunc: any) { | ||
(<any>di).annotate(classFunc, new (<any>di).Provide(targetClassFunc)); | ||
di.annotate(classFunc, new di.Provide(targetClassFunc)); | ||
}; | ||
@@ -24,0 +24,0 @@ } |
{ | ||
"name": "di-ts", | ||
"version": "0.0.16", | ||
"version": "0.0.17", | ||
"description": "Lightweight wrap and extension of angular/di.js for TypeScript.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
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
6393
128