打字稿依赖注入框架 [英] typescript dependency injection framework

查看:67
本文介绍了打字稿依赖注入框架的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用TypeScript(而不是angular)编写一个简单的库。我需要在该库中使用DI框架。我在Angular2中签出了DI框架,但这似乎有些过头了,我需要将我的整个库包装在一个我不想做的Angular模块中。

I am writing a simple library using TypeScript (not using angular). I need to use a DI framework in this library. I checked out the DI framework in Angular2, but this seems like an overkill and I need to wrap my whole library in an Angular module which I don't want to do.

推荐答案

我尚未在TypeScript / ES6中将DI用于生产(尚未),因为它们尚未完成。

I don't use DI in TypeScript/ES6 for production (yet) because they are not yet finalized.

为了进行实验,我使用了 needlepoint

For experimenting, I used needlepoint which was at the time I was using ES6.

但是对于打字稿, typescript-ioc 看起来更合适。它同时具有IOC和DI。

But for typescript, typescript-ioc looks like it's a better candidate. It has both IOC and DI.

这篇关于打字稿依赖注入框架的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆