@ghostmonitor/recart-di-loader
v7.6.1
Published
Loads local and remote dependencies in Recart's dependency injection system
Downloads
34
Readme
- Loads dependency injectable modules from
/services
directory - A module must return with a constructor that has a
dependencies
property
module.exports = function(dep1, dep2) {
// body of singleton service
}
module.exports.dependencies = ['dep1', 'dep2']
- If a dependency doesn't exist in
/services
that it tries to load the@ghostmonitor/recart-di-<depname>
npm package.
#Usage services/index.js:
const Bottle = require('bottlejs')
const di = new Bottle()
const loader = require('@ghostmonitor/recart-di-loader')
loader.loadLocalServices(di)
module.exports = di.container