The Targeted constructor type.
A prototype property decorator.
Factor an eager and lazy service:
import { Factor } from '@sgrud/core';
import { EagerService, LazyService } from './services';
export class ServiceHandler {
@Factor(() => EagerService)
private readonly service!: EagerService;
@Factor(() => LazyService, true)
private readonly service?: LazyService;
}
Generated using TypeDoc
Prototype property decorator factory. Applying this decorator replaces the decorated prototype property with a getter, which returns the linked instance of a Targeted constructor, referenced by the
targetFactory
. Depending on the suppliedtransient
value, the target constructor is invoked to construct (and link) an instance, if none is linked beforehand.