1234567891011121314151617181920212223242526272829 |
- import { Inject, Singleton } from "../../src/Decorator"
- import { COMPONENT_B_VALUE } from "../CONSTANTS"
- import { ComponentA } from "./ComponentA"
-
- export abstract class IComponentB{
- getFromA: () => string
- getFromThis: () => string
- }
-
- @Singleton(IComponentB)
- export class ComponentB implements IComponentB{
-
- @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
- }
- }
|