Minor refactor

This commit is contained in:
Catalin Constantin Mititiuc 2025-06-16 22:41:31 -07:00
parent e29bd0fb0f
commit 5f7c980ad5

View File

@ -106,12 +106,6 @@ function getRecord({ dataset: { allegiance: al, number: n }}) {
return document.querySelector(selector); return document.querySelector(selector);
} }
function addEventListeners() {
document.querySelectorAll('.soldier-record').forEach(el =>
el.addEventListener('click', () => Observable.notify('select', el))
);
}
function deselect() { function deselect() {
const selected = getSelected(); const selected = getSelected();
@ -166,7 +160,10 @@ export function start(startLoc, units) {
forces[affiliation].forEach(r => records.appendChild(r)); 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('select', select);
Observable.subscribe('endmove', endMove); Observable.subscribe('endmove', endMove);
addEventListeners();
} }