Open
Description
This differs from the @LateInject
decorator in that the dependency will be resolved the first time it's accessed without needing to call Obsidian.inject(this)
explicitly.
API
@Injectable(ApplicationGraph)
class Injected {
@LazyInject() foo!: Foo;
constructor() {
// foo is unresolved
this.foo.bar(); // foo is resolved on demand
}
}
Implementation
In order to achieve this behavior, the @LazyInject
decorator should probably return a Proxy which will resolve the dependency when it's required.