Skip to content

Add API: require('key', 'moduleName', injections || []); #5

@h4cc

Description

@h4cc

Using the same idea that electrolyte has: https://github.com/jaredhanson/electrolyte#annotations

Example:

module.exports = function Foo(bar) {
  console.log(bar);
};
module.exports['@singleton'] = true;
module.exports['@require'] = ['bar'];
var di = new Einigeln();

// Using the definitions from module:
di.require('foo', './foo');

// Using given definitions:
di.require('foo', './foo', ['anotherBar']);

Some more annotations matching to Einigeln API:

module.exports['@factory'] = true || false;
module.exports['@protect'] = true || false;

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions