fixes and tested deployment
This commit is contained in:
+2
-2
@@ -15,7 +15,7 @@ export function Singleton(_interface?: Constructor<any>): GenericClassDecorator<
|
||||
}
|
||||
|
||||
export function Inject(clazz: Constructor<any>) {
|
||||
return function (prototype: Object, key: string) {
|
||||
Injector['injectionQueue'].push({ injectionType: clazz, prototype: prototype, injectIntoKey: key })
|
||||
return function (instance: Object, key: string) {
|
||||
Injector['injectionQueue'].push({ injectionType: clazz, instance: instance, injectIntoKey: key })
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -13,7 +13,7 @@ class _Injector {
|
||||
* @param {Type<any>} target
|
||||
* @returns {T}
|
||||
*/
|
||||
public resolve<T>(target: Type<T>): T {
|
||||
public resolve<T>(target: Constructor<T>): T {
|
||||
if (!this.initialized) {
|
||||
this.initialize()
|
||||
this.initialized = true
|
||||
@@ -55,7 +55,7 @@ class _Injector {
|
||||
const inj = this.injectionQueue.shift()
|
||||
|
||||
if (this.moduleObjs[inj.injectionType.name]) {
|
||||
inj.prototype[inj.injectIntoKey] = this.moduleObjs[inj.injectionType.name]
|
||||
this.moduleObjs[inj.instance.constructor.name][inj.injectIntoKey] = this.moduleObjs[inj.injectionType.name]
|
||||
} else {
|
||||
throw new Error("Cannot resolve injection token " + inj.injectionType.name)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user