2.1.0 • Published 10 years ago

ajector v2.1.0

Weekly downloads
4
License
-
Repository
github
Last release
10 years ago

ajector

Asynchronous dependency injector.

Build Status

npm install ajector

Usage

  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.

2.1.0

10 years ago

2.0.1

10 years ago

1.0.0

11 years ago