INJEKT is a tiny, integration-tested dependency injection framework for NodeJS.
- Background Philosophy
- Installation
- Library Instantiation
- Module Injection
- Current Goals
- Future Thoughts
- Bug Reports + Other Requests
- Further Notes
Feel free to skip ahead if you know what you're looking for.
NOTE: This section is still under construction.
In addition to the options below, you can download either the raw export or package tarball.
npm install injekt
git clone [email protected]:arkbot/injekt.git
General Usage:
require('injekt')(
default_options
[, closure]
);
The following examples are all valid. Use them wisely.
var injekt = require('injekt')();
- NOTE:
closure
defaults to empty{ }
whendefault_options
are excluded.
var injekt = require('injekt')({
'context' : {
'inspect' : require('util').inspect
},
'mocks' : {
'assert' : require('should')
}
}, { });
var closure = {};
require('injekt')({
'context' : {
'inspect' : require('util').inspect
},
'mocks' : {
'assert' : require('should')
}
}, closure);
require('injekt')({
'context' : {
'inspect' : require('util').inspect
},
'mocks' : {
'assert' : require('should')
}
});
- NOTE:
closure
defaults toglobal
when excluded.
General Usage:
injekt(
module_path
[, options]
);
INJEKT gives you two different methods of injecting your dependencies:
context
: embed directly into theglobal
context of your product module.mock
: available as a mock to be retrieved viarequire(...)
inside your product module.
var my_module = injekt('./my_module.js', {
'context' : {
'EventEmitter' : require('events').EventEmitter
},
'mocks' : {
'Foo' : Object.create({ bar: function () { return 'YIPPPEEEE!'; } })
}
});
- NOTE:
module_path
must be relative to the overall working directory.
- Set up milestones on GitHub's Issue Tracker
- Create proper API + usage documentation
- Use factories for
params
parsing /properties
building - Integrate browser compatability:
- Setup individual interfaces for RequireJS and NodeJS.
- Investigate engine support for Contextify.
-
Please submit an issue on the GitHub Issue Tracker.
-
Please attach at least one of the following for bug reports:
- diagnostic procedure
- sample code
- assertion tests
-
Please e-mail me before sending a pull request.
- Released under the MIT License (attached).
- Accompanied by a full integration test suite, via
should
andvows
.