use
use<
T>(dependency):T
Use a dependency for this molecule. When you call use, then Bunshi will
automatically register that your molecule now depends on what you passed in.
If you depend on a scoped molecule, or a scope, then that will change how many instances of a molecule will be created. See Scopes for more details on scoping.
Use a MoleculeScope:
molecule(()=>use(UserScope));
Use a Molecule:
molecule(()=>use(UserMolecule));
Use a MoleculeInterface:
molecule(()=>use(NetworkMolecule));
Type parameters
| Parameter |
|---|
T |
Parameters
| Parameter | Type | Description |
|---|---|---|
dependency | MoleculeOrInterface< T > | MoleculeScope< T > | A dependency for this molecule to use, either another molecule, interface or scope |
Returns
T
the value of the dependency