A self hosted chat application with end-to-end encrypted messaging.
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.

33 lines
935 B

  1. import { Subject } from "./Observable";
  2. export interface Observer {
  3. // Receive update from subject.
  4. update(data: any): void;
  5. }
  6. // /**
  7. // * The Observer interface declares the update method, used by subjects.
  8. // */
  9. // interface Observer {
  10. // // Receive update from subject.
  11. // update(subject: Subject): void;
  12. // }
  13. // /**
  14. // * Concrete Observers react to the updates issued by the Subject they had been
  15. // * attached to.
  16. // */
  17. // class ConcreteObserverA implements Observer {
  18. // public update(subject: Subject): void {
  19. // if (subject.state < 3) {
  20. // console.log('ConcreteObserverA: Reacted to the event.');
  21. // }
  22. // }
  23. // }
  24. // class ConcreteObserverB implements Observer {
  25. // public update(subject: Subject): void {
  26. // if (subject.state === 0 || subject.state >= 2) {
  27. // console.log('ConcreteObserverB: Reacted to the event.');
  28. // }
  29. // }
  30. // }