fork download
  1. function DomController(minesweeperGame, domView) {
  2. //...установили что нужно
  3.  
  4. this._setEvents();
  5. }
  6.  
  7. DomController.prototype._setEvents = function() {
  8. var that = this;
  9. this._domView.setLeftMouseDownEventToCell(function(event) {
  10. if (event.which == 1) {
  11. that._domView.setFaceType("danger-face");
  12. }
  13. });
  14. this._domView.setLeftMouseUpEventToCell(function(event) {
  15. var target = event.target;
  16. if (event.which == 1) {
  17. that.open(target.dataset.x, target.dataset.y);
  18. that._domView.setFaceType("cool-face");
  19. }
  20. });
  21. this._domView.setRightDownEventToCell(function(event) {
  22. var target = event.target;
  23. if (event.which == 3) {
  24. that.toggleFlag.apply(that, [target.dataset.x, target.dataset.y]);
  25. }
  26. });
  27. this._domView.setClickEventToFace(function(event) {
  28. that.reset.call(that);
  29. });
  30. };
  31.  
  32. DomView.prototype.setLeftMouseUpEventToCell = function(func) {
  33. this._field.addEventListener("mouseup", func);
  34. };
  35.  
  36. //Поменять смайлик как в классическом сапере
  37. DomView.prototype.setLeftMouseDownEventToCell = function(func) {
  38. this._field.addEventListener("mousedown", func);
  39. };
  40.  
  41. //Установка флажков
  42. DomView.prototype.setRightDownEventToCell = function(func) {
  43. this._field.addEventListener("mousedown", func);
  44. };
  45.  
  46. DomView.prototype.setClickEventToFace = function(func) {
  47. this._face.addEventListener("click", func);
  48. };
Runtime error #stdin #stdout #stderr 0.03s 589312KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
/home/NcyeFe/prog.js:32
DomView.prototype.setLeftMouseUpEventToCell = function(func) {
^

ReferenceError: DomView is not defined
    at Object.<anonymous> (/home/NcyeFe/prog.js:32:1)
    at Module._compile (module.js:571:32)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:488:32)
    at tryModuleLoad (module.js:447:12)
    at Function.Module._load (module.js:439:3)
    at Module.runMain (module.js:605:10)
    at run (bootstrap_node.js:420:7)
    at startup (bootstrap_node.js:139:9)
    at bootstrap_node.js:535:3