|
|
@@ -1,3 +1,4 @@
|
|
|
+import {Service} from './service.js';
|
|
|
import {InvalidArgumentError} from './errors/index.js';
|
|
|
|
|
|
/**
|
|
|
@@ -63,7 +64,9 @@ export class ServiceContainer {
|
|
|
// новый экземпляр
|
|
|
if (!service || args.length) {
|
|
|
service =
|
|
|
- ctor.kind === 'Service' ? new ctor(this, ...args) : new ctor(...args);
|
|
|
+ ctor.kind === Service.kind
|
|
|
+ ? new ctor(this, ...args)
|
|
|
+ : new ctor(...args);
|
|
|
this._services.set(ctor, service);
|
|
|
// instantiates from a factory function
|
|
|
} else if (typeof service === 'function') {
|
|
|
@@ -100,7 +103,7 @@ export class ServiceContainer {
|
|
|
ctor,
|
|
|
);
|
|
|
const factory = () =>
|
|
|
- ctor.kind === 'Service' ? new ctor(this, ...args) : new ctor(...args);
|
|
|
+ ctor.kind === Service.kind ? new ctor(this, ...args) : new ctor(...args);
|
|
|
this._services.set(ctor, factory);
|
|
|
return this;
|
|
|
}
|
|
|
@@ -120,7 +123,7 @@ export class ServiceContainer {
|
|
|
ctor,
|
|
|
);
|
|
|
const service =
|
|
|
- ctor.kind === 'Service' ? new ctor(this, ...args) : new ctor(...args);
|
|
|
+ ctor.kind === Service.kind ? new ctor(this, ...args) : new ctor(...args);
|
|
|
this._services.set(ctor, service);
|
|
|
return this;
|
|
|
}
|