createInjector
createInjector(
injectorProps
={}
):MoleculeInjector
Creates a MoleculeInjector
This is the core stateful component of bunshi
and can have interfaces bound to implementations here.
Parameters
Parameter | Type |
---|---|
injectorProps | CreateInjectorProps |
Returns
Source
Example
Create an injector with bindings
const NumberMolecule = moleculeInterface<number>();
const RandomNumberMolecule = molecule<number>(()=>Math.random());
const injector = createInjector({
bindings:[[NumberMolecule,RandomNumberMolecule]]
})