Web Dev Solutions

Catalin Mititiuc

aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/record_sheet.js11
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();
}