I've created this two event listening function for my Minesweeper game. When I lose the game, I want to remove the event listeners so that I can't click on the cells after losing. How can I do it?
Thanks
board.oncontextmenu = function(e) {
var cellIndex = e.target.cellIndex;
var rowIndexx = e.target.parentNode.rowIndex;
right_click(rowIndexx, cellIndex);
}
board.onclick = function(e) {
var rowIndex = e.target.cellIndex;
var cellIndex = e.target.parentNode.rowIndex;
console.log("coluna: " + cellIndex + " linha: " + rowIndex);
if (primeira_jogada == 0 ) { timer(); }
if (isBomb(cellIndex, rowIndex) && firstmove == 0) {
moveBomb(cellIndex, rowIndex);
refresh();
}
if (isBomb && primeira_jogada !== 0) {
lose();
//event lister stops here
}
}