You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
lib/src/make.ts

14 lines
435 B

import {TypedDependencyKey} from './di'
import {Application} from './lifecycle/Application'
import {RequestLocalStorage} from './http/RequestLocalStorage'
export function make<T>(key: TypedDependencyKey<T>): T {
const container = Application.getApplication()
const rls = container.make<RequestLocalStorage>(RequestLocalStorage)
if ( rls.has() ) {
return rls.get().make(key)
}
return container.make(key)
}