【文件属性】:
文件名称:TypescriptDependencyInjection:类似于di.js,但更简单且具有类型
文件大小:11KB
文件格式:ZIP
更新时间:2021-05-07 15:54:00
TypeScript
依赖注入
打字稿的依赖注入。 受启发,但更简单且类型强。
要求
打字稿> = 1.5
在源中导入
编译选项:-- --experimentalDecorators --emitDecoratorMetadata --target ES5
快速开始
仅三个接触点: @Injectable , new Injector , Injector#getInstance
import Injector , { Injectable } from './index' ;
@ Injectable
class KlassA { }
@ Injectable
class KlassB {
constructor ( public dependency : KlassA ) { }
}
let injector = new Injector ( ) ;
let b = injector . getI
【文件预览】:
TypescriptDependencyInjection-master
----.travis.yml(38B)
----package.json(726B)
----readme.md(3KB)
----tslint.json(2KB)
----browser-tests.html(459B)
----tsconfig.json(229B)
----tests.ts(4KB)
----.gitignore(26B)
----tsd.json(338B)
----typings()
--------tsd.d.ts(83B)
--------mocha()
--------chai()
----index.ts(2KB)