@discordx/di
Advanced tools
Comparing version 2.0.0 to 2.0.1
@@ -34,7 +34,7 @@ "use strict"; | ||
addService(classType) { | ||
const myClass = classType; | ||
DIService._ServiceSet.add(myClass); | ||
const clazz = classType; | ||
DIService._ServiceSet.add(clazz); | ||
if (DIService.container) { | ||
if (this.isTsyringe(DIService.container)) { | ||
DIService.container.registerSingleton(myClass); | ||
DIService.container.registerSingleton(clazz); | ||
} | ||
@@ -46,15 +46,15 @@ else { | ||
*/ | ||
(0, typedi_1.Service)()(myClass); | ||
(0, typedi_1.Service)()(clazz); | ||
} | ||
} | ||
else { | ||
const instance = new myClass(); | ||
this._services.set(myClass, instance); | ||
const instance = new clazz(); | ||
this._services.set(clazz, instance); | ||
} | ||
} | ||
getService(classType) { | ||
const myClass = classType; | ||
const clazz = classType; | ||
if (DIService.container) { | ||
if (this.isTsyringe(DIService.container)) { | ||
return DIService.container.resolve(myClass); | ||
return DIService.container.resolve(clazz); | ||
} | ||
@@ -61,0 +61,0 @@ return DIService.container.get(classType); |
@@ -31,7 +31,7 @@ import { Service } from "typedi"; | ||
addService(classType) { | ||
const myClass = classType; | ||
DIService._ServiceSet.add(myClass); | ||
const clazz = classType; | ||
DIService._ServiceSet.add(clazz); | ||
if (DIService.container) { | ||
if (this.isTsyringe(DIService.container)) { | ||
DIService.container.registerSingleton(myClass); | ||
DIService.container.registerSingleton(clazz); | ||
} | ||
@@ -43,15 +43,15 @@ else { | ||
*/ | ||
Service()(myClass); | ||
Service()(clazz); | ||
} | ||
} | ||
else { | ||
const instance = new myClass(); | ||
this._services.set(myClass, instance); | ||
const instance = new clazz(); | ||
this._services.set(clazz, instance); | ||
} | ||
} | ||
getService(classType) { | ||
const myClass = classType; | ||
const clazz = classType; | ||
if (DIService.container) { | ||
if (this.isTsyringe(DIService.container)) { | ||
return DIService.container.resolve(myClass); | ||
return DIService.container.resolve(clazz); | ||
} | ||
@@ -58,0 +58,0 @@ return DIService.container.get(classType); |
{ | ||
"name": "@discordx/di", | ||
"version": "2.0.0", | ||
"version": "2.0.1", | ||
"private": false, | ||
@@ -5,0 +5,0 @@ "description": "dependency injection service with TSyringe support", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
24017