The interface of a dependency container
Protected
Build the dependency from the root
the generated tree
Provide the value to the container ProvideType.Value WARN: As you directly pass by this method, it will be available globally
ProvideType.Value
the unique key of the dependency, RECOMMENDED to use symbol
any thing you want to store
const UsernameDependency = Symbol("username")dependencyContainer.provide(UsernameDependencyKey, "bob") Copy
const UsernameDependency = Symbol("username")dependencyContainer.provide(UsernameDependencyKey, "bob")
Inject dependencies to the root and all of its children
The interface of a dependency container