Minor refactor

This commit is contained in:
Catalin Constantin Mititiuc 2024-05-22 09:28:49 -07:00
parent 8667e7e6da
commit d06277bad5

View File

@ -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();
}