make container property of global window

This commit is contained in:
Garrett Mills 2020-09-05 10:18:41 -05:00
parent c37b422d1d
commit 76f73851a7
Signed by: garrettmills
GPG Key ID: D2BF5FBA8298F246

View File

@ -2,6 +2,15 @@ import { Container } from './Container.ts'
import Instantiable from './type/Instantiable.ts' import Instantiable from './type/Instantiable.ts'
import { DependencyKey } from './type/DependencyKey.ts' import { DependencyKey } from './type/DependencyKey.ts'
const container = new Container() declare global {
const make = <T>(target: Instantiable<T>|DependencyKey, ...parameters: any[]) => container.make(target, ...parameters) var container: Container
interface Window { container: any }
}
if ( !window.container ) {
window.container = new Container()
}
const container = window.container
const make = <T>(target: Instantiable<T>|DependencyKey, ...parameters: any[]) => window.container.make(target, ...parameters)
export { container, make } export { container, make }