make container property of global window
This commit is contained in:
parent
c37b422d1d
commit
76f73851a7
@ -2,6 +2,15 @@ import { Container } from './Container.ts'
|
||||
import Instantiable from './type/Instantiable.ts'
|
||||
import { DependencyKey } from './type/DependencyKey.ts'
|
||||
|
||||
const container = new Container()
|
||||
const make = <T>(target: Instantiable<T>|DependencyKey, ...parameters: any[]) => container.make(target, ...parameters)
|
||||
declare global {
|
||||
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 }
|
||||
|
Loading…
Reference in New Issue
Block a user