Guest User

Untitled

a guest
Jun 25th, 2018
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. // Layer 1 (yellow) dependencies from domain
  2. import { WidgetType, IEntityGateway } from "../../../domain/src/index";
  3. // Layer 2 (red) local dependencies from usecase
  4. import { IInputBoundary, IOutputBoundary } from "../../../usecase/src/index";
  5.  
  6. // Lives in Layer 2 (red) in usecase
  7. export class Interactor implements IInputBoundary {
  8.  
  9. entityGateway: IEntityGateway;
  10. outputBoundary: IOutputBoundary;
  11.  
  12. constructor(entityGateway: IEntityGateway, outputBoundary: IOutputBoundary) {
  13. this.entityGateway = entityGateway;
  14. this.outputBoundary = outputBoundary;
  15. }
  16.  
  17. createWidget(widget: WidgetType): void {
  18. this.entityGateway.saveWidget(widget)
  19. .then((widget: WidgetType) => {
  20. this.outputBoundary.presentWidget(widget);
  21. });
  22. }
  23. }
Add Comment
Please, Sign In to add comment