Defur
Version: 0.2.0
Master build:
Develop build:
This library makes it easy to defer the construction or execution of a service until it's needed.
It can be installed in whichever way you prefer, but I recommend NPM.
Basic usage
var defur = require('defur');
var http = require('http');
var services = {
get server() {
return defur('server', this, function() {
return http.createServer().listen(3000);
});
}
};
defur.define('server', this, function() {
return http.createServer().listen(3000);
});
services.server.on('request', function() {});
services.server === services.server
Contributing
I accept contributions to the source via Pull Request,
but passing unit tests must be included before it will be considered for merge.
$ make install
$ make tests
If you have Vagrant installed, you can build the dev environment to assist development.
The repository will be mounted in /srv
.
$ vagrant up
$ vagrant ssh
Welcome to Ubuntu 12.04 LTS (GNU/Linux 3.2.0-23-generic x86_64)
$ cd /srv
License
The content of this library is released under the MIT License by Andrew Lawson.
You can find a copy of this license at http://www.opensource.org/licenses/mit or in LICENSE