Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

defur

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

defur

Defer construction of a service until it is needed.

  • 0.2.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

Defur

Defur

Version: 0.2.0
Master build: Master branch build status
Develop build: Develop branch build status

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'); // Just using HTTP as an example
var services = {

    // Define the service inline...
    get server() {
        return defur('server', this, function() {
            return http.createServer().listen(3000);
        });
    }

};

// ...or define the service later
defur.define('server', this, function() {
    return http.createServer().listen(3000);
});

// Use the service
services.server.on('request', function() {});

// Service is only created once
services.server === services.server // true

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

Keywords

FAQs

Package last updated on 23 Jul 2013

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc