1234567891011121314151617181920212223242526272829303132 |
- import { Inject, Singleton } from "../../src/Decorator"
- import { Initializable } from "../../src/Interfaces"
- import { COMPONENT_B_VALUE } from "../CONSTANTS"
- import { ComponentA } from "./ComponentA"
-
- export abstract class IComponentB{
- getFromA: () => string
- getFromThis: () => string
- }
-
- @Singleton({
- interface: IComponentB,
- })
- export class ComponentB implements IComponentB, Initializable{
-
- @Inject(ComponentA)
- private componentA: ComponentA
-
- private value: string
-
- getFromA(): string {
- return this.componentA.getFromThis()
- }
-
- getFromThis(): string {
- return this.value
- }
-
- initialize(): void{
- this.value = COMPONENT_B_VALUE
- }
- }
|