You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ComponentB.ts 611B

1234567891011121314151617181920212223242526272829
  1. import { Inject, Singleton } from "../../src/Decorator"
  2. import { COMPONENT_B_VALUE } from "../CONSTANTS"
  3. import { ComponentA } from "./ComponentA"
  4. export abstract class IComponentB{
  5. getFromA: () => string
  6. getFromThis: () => string
  7. }
  8. @Singleton(IComponentB)
  9. export class ComponentB implements IComponentB{
  10. @Inject(ComponentA)
  11. private componentA: ComponentA
  12. private value: string
  13. getFromA(): string {
  14. return this.componentA.getFromThis()
  15. }
  16. getFromThis(): string {
  17. return this.value
  18. }
  19. initialize(): void{
  20. this.value = COMPONENT_B_VALUE
  21. }
  22. }