0.2.8 • Published 8 years ago

depinject v0.2.8

Weekly downloads
5
License
MIT
Repository
github
Last release
8 years ago

depinject

Build Status Dependencies

ES6 decorator to inject dependencies into classes.

Usage

Install from npm

$ npm install depinject

Decorate classes with @inject. Pass in an object map of desired dependencies. You can then access them with this.getDep(key), giving the key of the desired dependency.

Example:

import inject from 'depinject';
import http from 'http';

@inject({http, process})
class Foo {
	someMethod() {
		let http = this.getDep('http'),
			process = this.getDep('process');
	}
}
0.2.8

8 years ago

0.2.7

8 years ago

0.2.6

8 years ago

0.2.5

8 years ago

0.2.4

8 years ago

0.2.3

8 years ago

0.2.2

8 years ago

0.2.1

8 years ago