ajector
Asynchronous dependency injector
Last updated 7 years ago by nailgun .
MIT · Repository · Original npm · Tarball · package.json
$ cnpm install ajector 
SYNC missed versions from official npm registry.

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.

Current Tags

  • 2.1.0                                ...           latest (7 years ago)

3 Versions

  • 2.1.0                                ...           7 years ago
  • 2.0.1                                ...           7 years ago
  • 1.0.0                                ...           7 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 3
Dependencies (3)
Dev Dependencies (2)
Dependents (3)

Copyright 2014 - 2016 © taobao.org |