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.

34 lines
997 B

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