From d06277bad51439595a02b449f50ce43645355d45 Mon Sep 17 00:00:00 2001
From: Catalin Mititiuc
Date: Wed, 22 May 2024 09:28:49 -0700
Subject: Minor refactor
---
src/modules/record_sheet.js | 11 ++++-------
1 file 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();
}
--
cgit v1.2.3