Source: main.js

  1. /**
  2. * @file project.js
  3. * @version March 20, 2017
  4. *
  5. * @author Olivier Pirson --- http://www.opimedia.be/
  6. * @license GPLv3 --- Copyright (C) 2017 Olivier Pirson
  7. */
  8. var globalController;
  9. (function () {
  10. "use strict";
  11. /**
  12. * Create matchings, views and controllers,
  13. * and update views.
  14. */
  15. function _init() {
  16. // Left panel
  17. const leftMatching = new Matching();
  18. const leftMatchingItem = document.getElementById('left-matching');
  19. const leftMatchingView = new MatchingView(leftMatching, leftMatchingItem);
  20. const leftMatchingController = new MatchingController(leftMatching, leftMatchingView);
  21. // Right panel
  22. const rightMatching = new Matching(leftMatching);
  23. const rightMatchingItem = document.getElementById('right-matching');
  24. const rightMatchingView = new MatchingView(rightMatching, rightMatchingItem, leftMatchingView);
  25. const rightMatchingController = new MatchingController(rightMatching, rightMatchingView);
  26. // Global
  27. const globalView = new GlobalView(leftMatchingView, rightMatchingView, document.getElementById("global-infos-container"), document.getElementById("list-matchings-container"), document.getElementById("infos-list-matchings-container"));
  28. globalController = new GlobalController(globalView, leftMatchingController, rightMatchingController);
  29. leftMatchingController.setGlobalView(globalView);
  30. rightMatchingController.setGlobalView(globalView);
  31. globalView.update();
  32. }
  33. /* Main */
  34. window.addEventListener("load", _init, false);
  35. }());