Asynchronous dependency injector

npm install ajector
9 downloads in the last week
15 downloads in the last month


Asynchronous dependency injector.

Build Status

npm install ajector


  1. Write modules

    // services/Service1.js
    module.exports = function () {
      return {};
  2. Setup injector

    var ajector = require('ajector');
    var injector = ajector(__dirname + '/services');
    injector.instance('config', config);
    injector.instance('db', db);
  3. Use injector

    injector.inject(function (Service1, db, config) {
      // this function will be called asynchronously after all required modules are initialized

For more details take a look at provided testsuite. There are all possible use cases.

npm loves you