Skip to content

Container

Defined in: src/decorators/util/container.ts:7

Simple Dependency Injection Container

new Container(): Container

Container

static get<T>(target): T

Defined in: src/decorators/util/container.ts:27

Get a service instance from the container.

T

(…args) => T

The constructor function of the service.

T

The instance of the service, or undefined if not found.


static has(target): boolean

Defined in: src/decorators/util/container.ts:36

Check if a service is registered in the container.

any

The constructor function of the service.

boolean

True if the service is registered, false otherwise.


static register<T>(target, instance): void

Defined in: src/decorators/util/container.ts:18

Register a service instance in the container.

T

(…args) => T

The constructor function of the service.

T

The instance of the service to register.

void


static resolve<T>(target): T

Defined in: src/decorators/util/container.ts:45

Resolve a service instance from the container.

T

(…args) => T

The constructor function of the service.

T

The instance of the service, or undefined if not found.


static teardown(): Promise<void>

Defined in: src/decorators/util/container.ts:113

Teardown the container, destroying all singletons and clearing the cache.

Promise<void>