youmeb-injector

這個 module 可以單獨與 express 使用,也會內建於 youmeb.js,youmeb.js 中會再做一些包裝。

npm install youmeb-injector
12 downloads in the last week
27 downloads in the last month

youmeb-injector

Quick start

main file

var injector = new Injector();

injector.initConfig({
  test: {
    msg: 'hello world !'
  }
});

injector.loadPackages(path.join(__dirname, 'youmeb'), function () {
  injector.init(function (err) {
    if (err) {
      console.error(err);
    }
  });
});

package main file

// package name: test
module.exports = function ($config, $dependencyPackage) {
  // $config namespace: _.config

  this.on('init', function (config) {
    // config namespace: _.config.test

    console.log(config.get('msg') === $config.get('test.msg')); // true
  });
};

License

(The MIT License)

Copyright (c) 2013 YouMeb and contributors.

npm loves you