index : btroops | |
Virtual board game-aid for BattleTroops, an infantry combat simulator wargame published by FASA in 1989. |
aboutsummaryrefslogtreecommitdiff |
diff options
author | Catalin Mititiuc <webdevcat@proton.me> | 2024-05-22 09:28:49 -0700 |
---|---|---|
committer | Catalin Mititiuc <webdevcat@proton.me> | 2024-05-22 09:28:49 -0700 |
commit | d06277bad51439595a02b449f50ce43645355d45 (patch) | |
tree | 4e36cd7ce4adf224ac227594bc250968b47202cd | |
parent | 8667e7e6da29e5615c5e3b1808d36490cf4c4ba7 (diff) |
Minor refactor
-rw-r--r-- | src/modules/record_sheet.js | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/src/modules/record_sheet.js b/src/modules/record_sheet.js index f13f5f8..9fbca9d 100644 --- a/src/modules/record_sheet.js +++ b/src/modules/record_sheet.js @@ -106,12 +106,6 @@ function getRecord({ dataset: { allegiance: al, number: n }}) { return document.querySelector(selector); } -function addEventListeners() { - document.querySelectorAll('.soldier-record').forEach(el => - el.addEventListener('click', () => Observable.notify('select', el)) - ); -} - function deselect() { const selected = getSelected(); @@ -166,7 +160,10 @@ export function start(startLoc, units) { forces[affiliation].forEach(r => records.appendChild(r)); } + document.querySelectorAll('.soldier-record').forEach(el => + el.addEventListener('click', () => Observable.notify('select', el)) + ); + Observable.subscribe('select', select); Observable.subscribe('endmove', endMove); - addEventListeners(); } |