di:经过实战测试的 Node.js 依赖注入器

时间:2021-06-05 11:20:13
【文件属性】:
文件名称:di:经过实战测试的 Node.js 依赖注入器
文件大小:16KB
文件格式:ZIP
更新时间:2021-06-05 11:20:13
javascript dependency-injector JavaScript 依赖注入器 这是一个包含两部分的模块示例:服务和数据库。 该服务取决于数据库。 这是db.js : module . exports = Db ; function Db ( ) { } Db . $inject = [ ] ; Db . prototype . answer = function ( ) { return 42 ; } ; 这是service.js : module . exports = Service ; function Service ( db ) { this . _db = db ; } Service . $inject = [ './db' ] ; Service . prototype . answer = function ( ) { return this . _db . answer ( ) ; } ; 请注意该服务
【文件预览】:
di-master
----.gitignore(24B)
----package.json(751B)
----.travis.yml(46B)
----LICENSE(1KB)
----bench()
--------suite.js(980B)
--------fixtures()
----examples()
--------simple-module()
----README.md(3KB)
----lib()
--------util.js(759B)
--------resolver.js(2KB)
--------package.js(338B)
--------instantiator.js(1KB)
--------index.js(266B)
----.npmignore(24B)
----test()
--------resolver-test.js(2KB)
--------index-test.js(896B)
--------fixtures()
--------instantiator-test.js(1KB)
--------util-test.js(526B)

网友评论