Comparing version 0.2.0 to 0.2.1
@@ -14,4 +14,3 @@ "use strict"; | ||
super(mesh, key); | ||
this.value = this.mesh.applyMiddleware(value); | ||
this.mesh.connect(this.value); | ||
this.value = this.mesh.connect(value); | ||
} | ||
@@ -30,4 +29,3 @@ get() { | ||
if (!this.instance) { | ||
this.instance = this.mesh.applyMiddleware(new this.ctor()); | ||
this.mesh.connect(this.instance); | ||
this.instance = this.mesh.connect(new this.ctor()); | ||
} | ||
@@ -34,0 +32,0 @@ return this.instance; |
@@ -16,6 +16,6 @@ import { Binding } from './bindings'; | ||
resolve<T>(key: ServiceKey<T>): T; | ||
connect(value: any): void; | ||
connect<T>(value: T): T; | ||
use(fn: Middleware): this; | ||
applyMiddleware<T>(value: T): T; | ||
protected _addMeshRef(value: any): void; | ||
protected applyMiddleware<T>(value: T): T; | ||
protected addMeshRef(value: any): void; | ||
} |
@@ -55,3 +55,5 @@ "use strict"; | ||
connect(value) { | ||
this._addMeshRef(value); | ||
const res = this.applyMiddleware(value); | ||
this.addMeshRef(res); | ||
return res; | ||
} | ||
@@ -69,3 +71,3 @@ use(fn) { | ||
} | ||
_addMeshRef(value) { | ||
addMeshRef(value) { | ||
if (typeof value !== 'object') { | ||
@@ -72,0 +74,0 @@ return; |
{ | ||
"name": "mesh-ioc", | ||
"version": "0.2.0", | ||
"version": "0.2.1", | ||
"description": "Mesh: Powerful and Lightweight IoC Library", | ||
@@ -5,0 +5,0 @@ "main": "out/main/index.js", |
17659