Web Dev Solutions

Catalin Mititiuc

From bbd58ed2a0691987d21b20c3ab7d301727d46d1e Mon Sep 17 00:00:00 2001 From: Catalin Mititiuc Date: Sat, 27 Apr 2024 10:28:16 -0700 Subject: Remove calling record sheet object with 'new' --- src/index.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/index.js b/src/index.js index 90404d9..bc4f138 100644 --- a/src/index.js +++ b/src/index.js @@ -1,8 +1,8 @@ import PanZoom from './modules/panzoom.js'; import Game from './modules/game.js'; -const RecordSheet = new function () { - this.unSelect = function () { +const RecordSheet = { + unSelect: function () { let selected = this.getSelected(); if (selected) { @@ -10,19 +10,19 @@ const RecordSheet = new function () { } document.getElementById('toggle-prone-counter').checked = false; - }; + }, - this.getSelected = function () { + getSelected: function () { return document.querySelector('.soldier-record.selected'); - }; + }, - this.select = function (data) { + select: function (data) { this.unSelect(); document.querySelector(`#record-sheet .soldier-record[data-number="${data.number}"][data-allegiance="${data.allegiance}"]`).classList.add('selected'); document.getElementById('toggle-prone-counter').checked = data.prone; - }; + }, - this.endMove = function() { + endMove: function() { const selected = this.getSelected(); if (selected) { @@ -30,7 +30,7 @@ const RecordSheet = new function () { } this.unSelect(); - }; + } }; const mapPlaceholder = document.querySelector('.map-placeholder'); -- cgit v1.2.3