container-ioc
Advanced tools
Comparing version
@@ -1,2 +0,2 @@ | ||
import { IInjectionInstance, IProvider, ProviderToken } from './interfaces'; | ||
import { IConstructor, IInjectionInstance, IProvider, ProviderToken } from './interfaces'; | ||
import { IContainer } from './container.interface'; | ||
@@ -7,3 +7,3 @@ export declare class Container implements IContainer { | ||
constructor(parent?: IContainer | undefined); | ||
register(provider: IProvider | IProvider[]): void; | ||
register(provider: IProvider | IProvider[] | IConstructor): void; | ||
resolve(token: ProviderToken): IInjectionInstance; | ||
@@ -10,0 +10,0 @@ createScope(): IContainer; |
@@ -1,6 +0,6 @@ | ||
import { IInjectionInstance, IProvider, ProviderToken } from './interfaces'; | ||
import { IConstructor, IInjectionInstance, IProvider, ProviderToken } from './interfaces'; | ||
export interface IContainer { | ||
register(provider: IProvider | IProvider[] | Function): void; | ||
register(provider: IProvider | IProvider[] | IConstructor): void; | ||
resolve(token: ProviderToken): IInjectionInstance; | ||
createScope(): IContainer; | ||
} |
@@ -13,3 +13,3 @@ "use strict"; | ||
if (provider instanceof Array) { | ||
provider.forEach(function (provider) { return _this.registerOne(provider); }); | ||
provider.forEach(function (p) { return _this.registerOne(p); }); | ||
} | ||
@@ -16,0 +16,0 @@ else { |
import 'reflect-metadata'; | ||
export declare const INJECTIONS_MD_KEY: string; | ||
export declare function Inject(token: any): (target: Object, propertyKey: string | symbol, parameterIndex: number) => void; | ||
export declare function Inject(token: any): (target: object, propertyKey: string | symbol, parameterIndex: number) => void; |
@@ -11,2 +11,6 @@ export declare type ProviderToken = any; | ||
export interface IInjectionInstance { | ||
[key: string]: any; | ||
} | ||
export interface IConstructor { | ||
new (...args: any[]): any; | ||
} |
@@ -1,5 +0,5 @@ | ||
import { IInjectionInstance } from './interfaces'; | ||
import { IConstructor, IInjectionInstance } from './interfaces'; | ||
export interface IRegistryData { | ||
instance: IInjectionInstance; | ||
cls: any; | ||
cls: IConstructor; | ||
} | ||
@@ -6,0 +6,0 @@ export declare class RegistryData { |
const gulp = require('gulp'); | ||
const ts = require('gulp-typescript'); | ||
const mocha = require('gulp-mocha'); | ||
const tslint = require('gulp-tslint'); | ||
@@ -32,2 +33,11 @@ let tsProjectDevelopment = ts.createProject('tsconfig.json'); | ||
})) | ||
}); | ||
}); | ||
gulp.task("tslint", () => | ||
gulp.src("src/**/*.ts") | ||
.pipe(tslint({ | ||
configuration: "./tslint.json" | ||
})) | ||
.pipe(tslint.report()) | ||
); |
{ | ||
"name": "container-ioc", | ||
"version": "1.0.1", | ||
"version": "1.0.3", | ||
"description": "IoC container for browser and nodejs environments", | ||
"scripts": { | ||
"build": "./node_modules/.bin/tsc", | ||
"test": "mocha --reporter dot -w './**/*.spec.js'" | ||
"build": "tsc -w", | ||
"test": "mocha --reporter dot -w 'dist/**/*.spec.js'" | ||
}, | ||
@@ -24,2 +24,3 @@ "main": "dist/lib/index.js", | ||
"@types/chai": "^4.0.4", | ||
"@types/core-js": "^0.9.43", | ||
"@types/mocha": "^2.2.43", | ||
@@ -29,4 +30,7 @@ "chai": "^4.1.2", | ||
"gulp-mocha": "^4.3.1", | ||
"gulp-tslint": "^8.1.2", | ||
"gulp-typescript": "^3.2.2", | ||
"mocha": "^3.5.2", | ||
"tslint": "^5.7.0", | ||
"tslint-microsoft-contrib": "^5.0.1", | ||
"typescript": "^2.5.2" | ||
@@ -33,0 +37,0 @@ }, |
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
64499
18.05%25
8.7%214
23.7%12
50%