Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/alosaur/src/injection/types/index.ts>DependencyContainer

Alosaur - Deno web framework with many decorators
Go to Latest
interface DependencyContainer
import { type DependencyContainer } from "https://deno.land/x/alosaur@v0.24.1/src/injection/types/index.ts";

Methods

register<T>(token: InjectionToken<T>, provider: ValueProvider<T>): DependencyContainer
register<T>(token: InjectionToken<T>, provider: FactoryProvider<T>): DependencyContainer
register<T>(
token: InjectionToken<T>,
provider: TokenProvider<T>,
): DependencyContainer
register<T>(
token: InjectionToken<T>,
provider: ClassProvider<T>,
): DependencyContainer
register<T>(
token: InjectionToken<T>,
provider: constructor<T>,
): DependencyContainer
registerSingleton<T>(from: InjectionToken<T>, to: InjectionToken<T>): DependencyContainer
registerSingleton<T>(token: constructor<T>): DependencyContainer
registerType<T>(from: InjectionToken<T>, to: InjectionToken<T>): DependencyContainer
registerInstance<T>(token: InjectionToken<T>, instance: T): DependencyContainer
resolve<T>(token: InjectionToken<T>): T

Resolve a token into an instance

resolveAll<T>(token: InjectionToken<T>): T[]
isRegistered<T>(token: InjectionToken<T>, recursive?: boolean): boolean

Check if the given dependency is registered

reset(): void

Clears all registered tokens

clearInstances(): void
createChildContainer(): DependencyContainer