BREAKING CHANGE: Consumers must use ESM-compatible environments. All import paths now include .js extensions. CommonJS (require) is no longer supported.
40 lines
1.3 KiB
TypeScript
40 lines
1.3 KiB
TypeScript
import { TSinjex } from '../classes/TSinjex.js';
|
|
import { Identifier } from '../types/Identifier.js';
|
|
|
|
/**
|
|
* Register a dependency.
|
|
* @param identifier The identifier used to register the class in the DI container.
|
|
* @see {@link Identifier} for more information on identifiers..
|
|
* @param dependency The dependency to register.
|
|
*/
|
|
export function register<T>(identifier: Identifier, dependency: T): void;
|
|
|
|
/**
|
|
* Register a dependency.
|
|
* @param identifier The identifier used to register the class in the DI container.
|
|
* @see {@link Identifier} for more information on identifiers.
|
|
* @param dependency The dependency to register.
|
|
* @param deprecated A warning is logged when the dependency is resolved.
|
|
*/
|
|
export function register<T>(
|
|
identifier: Identifier,
|
|
dependency: T,
|
|
deprecated?: true,
|
|
): void;
|
|
|
|
/**
|
|
* Register a dependency.
|
|
* @param identifier The identifier used to register the class in the DI container.
|
|
* @see {@link Identifier} for more information on identifiers.
|
|
* @param dependency The dependency to register.
|
|
* @param deprecated If true, the dependency is deprecated => a warning
|
|
* is logged when the dependency is resolved.
|
|
*/
|
|
export function register<T>(
|
|
identifier: Identifier,
|
|
dependency: T,
|
|
deprecated?: boolean,
|
|
): void {
|
|
TSinjex.getInstance().register(identifier, dependency, deprecated);
|
|
}
|