Guest User

Untitled

a guest
Nov 23rd, 2017
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. class Cell {
  2.  
  3. constructor(element) {
  4. this.view = document.createElement(element);
  5. this.value = cellSymbol.NO_MINE;
  6. }
  7.  
  8. isMine() { return this.value == cellSymbol.MINE; }
  9. makeMine() { this.value = cellSymbol.MINE; }
  10. getView() { return this.view; }
  11. addOnClickFn(func) { this.view.onclick = func; }
  12. removeOnClickFn() { this.view.onclick = ''; }
  13. addClassStyle(style) { this.view.className = style; }
  14. openCell(style) {
  15. this.view.className = style;
  16. this.value = cellSymbol.OPEN_CELL;
  17. }
  18. }
  19.  
  20. Cell.prototype.cellSymbol = Object.freeze({
  21. NO_MINE: 0,
  22. MINE: 9,
  23. OPEN_CELL: '#'
  24. });
  25.  
  26. cell = new Cell('td');
Add Comment
Please, Sign In to add comment