dependency-injection
Advanced tools
Comparing version 1.0.1 to 1.1.0
@@ -15,2 +15,3 @@ // Generated by CoffeeScript 1.6.3 | ||
"arguments": [], | ||
instantiate: true, | ||
setup: {} | ||
@@ -41,2 +42,3 @@ }; | ||
s = di.addService(name, service.service, service["arguments"]); | ||
s.instantiate = service.instantiate; | ||
_ref = service.setup; | ||
@@ -43,0 +45,0 @@ for (method in _ref) { |
@@ -12,2 +12,4 @@ // Generated by CoffeeScript 1.6.3 | ||
Service.prototype.instantiate = true; | ||
Service.prototype.setup = null; | ||
@@ -44,4 +46,6 @@ | ||
}; | ||
Service = require(this.service); | ||
service = new (wrapper(Service, this.di.autowireArguments(Service, this["arguments"]))); | ||
service = require(this.service); | ||
if (this.instantiate === true) { | ||
service = new (wrapper(service, this.di.autowireArguments(service, this["arguments"]))); | ||
} | ||
called = []; | ||
@@ -48,0 +52,0 @@ _ref = this.setup; |
{ | ||
"name": "dependency-injection", | ||
"description": "Dependency injection with configuration and autowire for node js and browser", | ||
"version": "1.0.1", | ||
"version": "1.1.0", | ||
"author": { | ||
@@ -6,0 +6,0 @@ "name": "David Kudera", |
@@ -83,2 +83,18 @@ # Dependency injection | ||
## Not instantiate services | ||
When you want for example use jQuery as service, you will not want to automatically call something like `new jquery`. | ||
So you can tell DI, that this service will not be instantiate. | ||
``` | ||
{ | ||
"services": { | ||
"jquery": { | ||
"service": "jquery" | ||
"instantiate": false | ||
} | ||
} | ||
} | ||
``` | ||
## Autowiring | ||
@@ -123,4 +139,4 @@ | ||
Maybe it will be better for someone to use this DI without configuration, so here is example of application and translator | ||
definition. | ||
Maybe it will be better for someone to use this DI without configuration, so here is example of application, translator | ||
and jquery definition. | ||
@@ -137,2 +153,5 @@ ``` | ||
.addSetup('setLanguage', ['en']); | ||
var service = di.addService('jquery', 'jquery'); | ||
service.instantiate = false; | ||
``` | ||
@@ -146,2 +165,5 @@ | ||
* 1.0.1 | ||
+ Added informations about autowiring factories | ||
+ Added informations about autowiring factories | ||
* 1.1.0 | ||
+ Support for not-instantiate services |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
16039
181
165