🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Sign inDemoInstall
Socket

pang

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pang

A simple dependency injection library for node

0.6.0
latest
Source
npm
Version published
Maintainers
1
Created
Source

pang

A simple dependency injection library for node

npm install pang

example

The following example illustates setting up a pang domain/kernel.


var pang = require('pang')

var domain = pang.domain()

domain.factory('http', require('http'))

domain.factory('configuration', {

	server: {

		port: 8080
	}
})

domain.factory('repository', function(configuration) {

	return new Repository(configuration)
})

domain.factory('server', function(configuration, http, repository) {
	
	return new Server(configuration, http, repository)
})

domain.start()

Boots all instances in this domain and caches within the domain.

domain.start()

domain.singleton()

Returns a singleton instance from the domain. Will automatically start() the domain if not already started.

var instance = domain.singleton('repository')

domain.transient()

Returns a transient (new) instance from the domain.

var instance = domain.transient('repository')

Keywords

di

FAQs

Package last updated on 12 Dec 2014

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