containerjs
Advanced tools
+2
-2
| { | ||
| "name": "containerjs", | ||
| "description": "Container", | ||
| "version": "0.0.1", | ||
| "version": "0.0.2", | ||
| "main": "src/container.js", | ||
@@ -10,3 +10,3 @@ "directories": { | ||
| "scripts": { | ||
| "test": "jasmine-node test/ --autotest --watch" | ||
| "test": "jasmine-node test/" | ||
| }, | ||
@@ -13,0 +13,0 @@ "repository": { |
+12
-12
@@ -8,24 +8,24 @@ (function() { | ||
| Container.prototype.bind = function(abstract, impl) { | ||
| this._bindings[abstract] = impl; | ||
| Container.prototype.bind = function(name, impl) { | ||
| this._bindings[name] = impl; | ||
| }; | ||
| Container.prototype.make = function(abstract) { | ||
| if (this._bindings[abstract]) { | ||
| return this._bindings[abstract](); | ||
| Container.prototype.make = function(name) { | ||
| if (this._bindings[name]) { | ||
| return this._bindings[name](); | ||
| } | ||
| if (typeof this._singletons[abstract] === 'function') { | ||
| this._singletons[abstract] = this._singletons[abstract](); | ||
| if (typeof this._singletons[name] === 'function') { | ||
| this._singletons[name] = this._singletons[name](); | ||
| } | ||
| return this._singletons[abstract]; | ||
| return this._singletons[name]; | ||
| }; | ||
| Container.prototype.singleton = function(abstract, impl) { | ||
| this._singletons[abstract] = impl; | ||
| Container.prototype.singleton = function(name, impl) { | ||
| this._singletons[name] = impl; | ||
| }; | ||
| Container.prototype.instance = function(abstract, impl) { | ||
| this._singletons[abstract] = impl; | ||
| Container.prototype.instance = function(name, impl) { | ||
| this._singletons[name] = impl; | ||
| }; | ||
@@ -32,0 +32,0 @@ |
3272
-2.12%