Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Cell {
- constructor(element) {
- this.view = document.createElement(element);
- this.value = cellSymbol.NO_MINE;
- }
- isMine() { return this.value == cellSymbol.MINE; }
- makeMine() { this.value = cellSymbol.MINE; }
- getView() { return this.view; }
- addOnClickFn(func) { this.view.onclick = func; }
- removeOnClickFn() { this.view.onclick = ''; }
- addClassStyle(style) { this.view.className = style; }
- openCell(style) {
- this.view.className = style;
- this.value = cellSymbol.OPEN_CELL;
- }
- }
- Cell.prototype.cellSymbol = Object.freeze({
- NO_MINE: 0,
- MINE: 9,
- OPEN_CELL: '#'
- });
- cell = new Cell('td');
Add Comment
Please, Sign In to add comment